Fwd: Optimization flags causing segfault on clang

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: Optimization flags causing segfault on clang

Boris Kolpackov via cfe-dev
Hey, 

Context: Android native code built with clang using Android Studio.

We have been using GCC(Eclipse) for quite a while, now we are trying to move our huge code base to clang (to AndroidStudio). 

With GCC we were using -O3 optimization and everything was working fine, but with clang, even -O1 is causing Android apps to crash on runtime with the seg fault. 

Since apps are working fine when compiled with -O0, so my guess is some kind of optimization is not supported for our code base which is/are introduced by O1/2/3 flags.

Is there a way I can disable the flags introduced by -O1 one-by-one to figure out the culprit flag(s)?

Can anyone suggest me such flags to disable optimizations one-by-one? I tried googling but could not find much help.

I am stuck on this issue for quite a while now. I would really appreciate the help. I am looking for a more general advice on flags to disable optimizations one-by-one with -O1, because making changes in the code base would not be possible. 

Thanks. 
Rohit Kumar



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Optimization flags causing segfault on clang

Boris Kolpackov via cfe-dev
You can use -mllvm -opt-bisect-limit=<limit> to bisect where the error occurs. More documentation here http://llvm.org/docs/OptBisect.html

~Craig

On Thu, Jul 6, 2017 at 11:18 PM, ROHIT KUMAR via cfe-dev <[hidden email]> wrote:
Hey, 

Context: Android native code built with clang using Android Studio.

We have been using GCC(Eclipse) for quite a while, now we are trying to move our huge code base to clang (to AndroidStudio). 

With GCC we were using -O3 optimization and everything was working fine, but with clang, even -O1 is causing Android apps to crash on runtime with the seg fault. 

Since apps are working fine when compiled with -O0, so my guess is some kind of optimization is not supported for our code base which is/are introduced by O1/2/3 flags.

Is there a way I can disable the flags introduced by -O1 one-by-one to figure out the culprit flag(s)?

Can anyone suggest me such flags to disable optimizations one-by-one? I tried googling but could not find much help.

I am stuck on this issue for quite a while now. I would really appreciate the help. I am looking for a more general advice on flags to disable optimizations one-by-one with -O1, because making changes in the code base would not be possible. 

Thanks. 
Rohit Kumar



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Optimization flags causing segfault on clang

Boris Kolpackov via cfe-dev
Thanks, Craig. 

So with this argument, the build failed on compilation with the last log as

"BISECT: NOT running pass (60626) optimize barriers pass on function ... "

It points to a function in a class where we also had a high suspicion for. So it makes sense. 

So it is very likely that the way our code is written is not meeting the standards used by clang and one or other optimization is breaking it.

Do you have any idea which flag is doing this "optimize barriers pass on function" which we can ignore? 


On Fri, Jul 7, 2017 at 11:55 AM, Craig Topper <[hidden email]> wrote:
You can use -mllvm -opt-bisect-limit=<limit> to bisect where the error occurs. More documentation here http://llvm.org/docs/OptBisect.html

~Craig

On Thu, Jul 6, 2017 at 11:18 PM, ROHIT KUMAR via cfe-dev <[hidden email]> wrote:
Hey, 

Context: Android native code built with clang using Android Studio.

We have been using GCC(Eclipse) for quite a while, now we are trying to move our huge code base to clang (to AndroidStudio). 

With GCC we were using -O3 optimization and everything was working fine, but with clang, even -O1 is causing Android apps to crash on runtime with the seg fault. 

Since apps are working fine when compiled with -O0, so my guess is some kind of optimization is not supported for our code base which is/are introduced by O1/2/3 flags.

Is there a way I can disable the flags introduced by -O1 one-by-one to figure out the culprit flag(s)?

Can anyone suggest me such flags to disable optimizations one-by-one? I tried googling but could not find much help.

I am stuck on this issue for quite a while now. I would really appreciate the help. I am looking for a more general advice on flags to disable optimizations one-by-one with -O1, because making changes in the code base would not be possible. 

Thanks. 
Rohit Kumar



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Optimization flags causing segfault on clang

Boris Kolpackov via cfe-dev
You got a compilation failure not a runtime failure?

On Fri, Jul 7, 2017 at 12:19 AM ROHIT KUMAR <[hidden email]> wrote:
Thanks, Craig. 

So with this argument, the build failed on compilation with the last log as

"BISECT: NOT running pass (60626) optimize barriers pass on function ... "

It points to a function in a class where we also had a high suspicion for. So it makes sense. 

So it is very likely that the way our code is written is not meeting the standards used by clang and one or other optimization is breaking it.

Do you have any idea which flag is doing this "optimize barriers pass on function" which we can ignore? 


On Fri, Jul 7, 2017 at 11:55 AM, Craig Topper <[hidden email]> wrote:
You can use -mllvm -opt-bisect-limit=<limit> to bisect where the error occurs. More documentation here http://llvm.org/docs/OptBisect.html

~Craig

On Thu, Jul 6, 2017 at 11:18 PM, ROHIT KUMAR via cfe-dev <[hidden email]> wrote:
Hey, 

Context: Android native code built with clang using Android Studio.

We have been using GCC(Eclipse) for quite a while, now we are trying to move our huge code base to clang (to AndroidStudio). 

With GCC we were using -O3 optimization and everything was working fine, but with clang, even -O1 is causing Android apps to crash on runtime with the seg fault. 

Since apps are working fine when compiled with -O0, so my guess is some kind of optimization is not supported for our code base which is/are introduced by O1/2/3 flags.

Is there a way I can disable the flags introduced by -O1 one-by-one to figure out the culprit flag(s)?

Can anyone suggest me such flags to disable optimizations one-by-one? I tried googling but could not find much help.

I am stuck on this issue for quite a while now. I would really appreciate the help. I am looking for a more general advice on flags to disable optimizations one-by-one with -O1, because making changes in the code base would not be possible. 

Thanks. 
Rohit Kumar



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



--
~Craig

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Optimization flags causing segfault on clang

Boris Kolpackov via cfe-dev
Yes. With this flag, I got compilation failure.

On Jul 7, 2017 1:28 PM, "Craig Topper" <[hidden email]> wrote:
You got a compilation failure not a runtime failure?

On Fri, Jul 7, 2017 at 12:19 AM ROHIT KUMAR <[hidden email]> wrote:
Thanks, Craig. 

So with this argument, the build failed on compilation with the last log as

"BISECT: NOT running pass (60626) optimize barriers pass on function ... "

It points to a function in a class where we also had a high suspicion for. So it makes sense. 

So it is very likely that the way our code is written is not meeting the standards used by clang and one or other optimization is breaking it.

Do you have any idea which flag is doing this "optimize barriers pass on function" which we can ignore? 


On Fri, Jul 7, 2017 at 11:55 AM, Craig Topper <[hidden email]> wrote:
You can use -mllvm -opt-bisect-limit=<limit> to bisect where the error occurs. More documentation here http://llvm.org/docs/OptBisect.html

~Craig

On Thu, Jul 6, 2017 at 11:18 PM, ROHIT KUMAR via cfe-dev <[hidden email]> wrote:
Hey, 

Context: Android native code built with clang using Android Studio.

We have been using GCC(Eclipse) for quite a while, now we are trying to move our huge code base to clang (to AndroidStudio). 

With GCC we were using -O3 optimization and everything was working fine, but with clang, even -O1 is causing Android apps to crash on runtime with the seg fault. 

Since apps are working fine when compiled with -O0, so my guess is some kind of optimization is not supported for our code base which is/are introduced by O1/2/3 flags.

Is there a way I can disable the flags introduced by -O1 one-by-one to figure out the culprit flag(s)?

Can anyone suggest me such flags to disable optimizations one-by-one? I tried googling but could not find much help.

I am stuck on this issue for quite a while now. I would really appreciate the help. I am looking for a more general advice on flags to disable optimizations one-by-one with -O1, because making changes in the code base would not be possible. 

Thanks. 
Rohit Kumar



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



--
~Craig

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Optimization flags causing segfault on clang

Boris Kolpackov via cfe-dev
That's not supposed to happen. What was the failure?

On Fri, Jul 7, 2017 at 1:01 AM ROHIT KUMAR <[hidden email]> wrote:
Yes. With this flag, I got compilation failure.

On Jul 7, 2017 1:28 PM, "Craig Topper" <[hidden email]> wrote:
You got a compilation failure not a runtime failure?

On Fri, Jul 7, 2017 at 12:19 AM ROHIT KUMAR <[hidden email]> wrote:
Thanks, Craig. 

So with this argument, the build failed on compilation with the last log as

"BISECT: NOT running pass (60626) optimize barriers pass on function ... "

It points to a function in a class where we also had a high suspicion for. So it makes sense. 

So it is very likely that the way our code is written is not meeting the standards used by clang and one or other optimization is breaking it.

Do you have any idea which flag is doing this "optimize barriers pass on function" which we can ignore? 


On Fri, Jul 7, 2017 at 11:55 AM, Craig Topper <[hidden email]> wrote:
You can use -mllvm -opt-bisect-limit=<limit> to bisect where the error occurs. More documentation here http://llvm.org/docs/OptBisect.html

~Craig

On Thu, Jul 6, 2017 at 11:18 PM, ROHIT KUMAR via cfe-dev <[hidden email]> wrote:
Hey, 

Context: Android native code built with clang using Android Studio.

We have been using GCC(Eclipse) for quite a while, now we are trying to move our huge code base to clang (to AndroidStudio). 

With GCC we were using -O3 optimization and everything was working fine, but with clang, even -O1 is causing Android apps to crash on runtime with the seg fault. 

Since apps are working fine when compiled with -O0, so my guess is some kind of optimization is not supported for our code base which is/are introduced by O1/2/3 flags.

Is there a way I can disable the flags introduced by -O1 one-by-one to figure out the culprit flag(s)?

Can anyone suggest me such flags to disable optimizations one-by-one? I tried googling but could not find much help.

I am stuck on this issue for quite a while now. I would really appreciate the help. I am looking for a more general advice on flags to disable optimizations one-by-one with -O1, because making changes in the code base would not be possible. 

Thanks. 
Rohit Kumar



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



--
~Craig
--
~Craig

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Optimization flags causing segfault on clang

Boris Kolpackov via cfe-dev
This is weird, I ran the build again and this time it showed error at a different location. 

Inline image 1

On Fri, Jul 7, 2017 at 1:35 PM, Craig Topper <[hidden email]> wrote:
That's not supposed to happen. What was the failure?

On Fri, Jul 7, 2017 at 1:01 AM ROHIT KUMAR <[hidden email]> wrote:
Yes. With this flag, I got compilation failure.

On Jul 7, 2017 1:28 PM, "Craig Topper" <[hidden email]> wrote:
You got a compilation failure not a runtime failure?

On Fri, Jul 7, 2017 at 12:19 AM ROHIT KUMAR <[hidden email]> wrote:
Thanks, Craig. 

So with this argument, the build failed on compilation with the last log as

"BISECT: NOT running pass (60626) optimize barriers pass on function ... "

It points to a function in a class where we also had a high suspicion for. So it makes sense. 

So it is very likely that the way our code is written is not meeting the standards used by clang and one or other optimization is breaking it.

Do you have any idea which flag is doing this "optimize barriers pass on function" which we can ignore? 


On Fri, Jul 7, 2017 at 11:55 AM, Craig Topper <[hidden email]> wrote:
You can use -mllvm -opt-bisect-limit=<limit> to bisect where the error occurs. More documentation here http://llvm.org/docs/OptBisect.html

~Craig

On Thu, Jul 6, 2017 at 11:18 PM, ROHIT KUMAR via cfe-dev <[hidden email]> wrote:
Hey, 

Context: Android native code built with clang using Android Studio.

We have been using GCC(Eclipse) for quite a while, now we are trying to move our huge code base to clang (to AndroidStudio). 

With GCC we were using -O3 optimization and everything was working fine, but with clang, even -O1 is causing Android apps to crash on runtime with the seg fault. 

Since apps are working fine when compiled with -O0, so my guess is some kind of optimization is not supported for our code base which is/are introduced by O1/2/3 flags.

Is there a way I can disable the flags introduced by -O1 one-by-one to figure out the culprit flag(s)?

Can anyone suggest me such flags to disable optimizations one-by-one? I tried googling but could not find much help.

I am stuck on this issue for quite a while now. I would really appreciate the help. I am looking for a more general advice on flags to disable optimizations one-by-one with -O1, because making changes in the code base would not be possible. 

Thanks. 
Rohit Kumar



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



--
~Craig
--
~Craig


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Optimization flags causing segfault on clang

Boris Kolpackov via cfe-dev
This is weird, I ran the build again and this time it showed error at a different location. 
`Inline image 1

On Fri, Jul 7, 2017 at 1:49 PM, ROHIT KUMAR <[hidden email]> wrote:
This is weird, I ran the build again and this time it showed error at a different location. 

Inline image 1

On Fri, Jul 7, 2017 at 1:35 PM, Craig Topper <[hidden email]> wrote:
That's not supposed to happen. What was the failure?

On Fri, Jul 7, 2017 at 1:01 AM ROHIT KUMAR <[hidden email]> wrote:
Yes. With this flag, I got compilation failure.

On Jul 7, 2017 1:28 PM, "Craig Topper" <[hidden email]> wrote:
You got a compilation failure not a runtime failure?

On Fri, Jul 7, 2017 at 12:19 AM ROHIT KUMAR <[hidden email]> wrote:
Thanks, Craig. 

So with this argument, the build failed on compilation with the last log as

"BISECT: NOT running pass (60626) optimize barriers pass on function ... "

It points to a function in a class where we also had a high suspicion for. So it makes sense. 

So it is very likely that the way our code is written is not meeting the standards used by clang and one or other optimization is breaking it.

Do you have any idea which flag is doing this "optimize barriers pass on function" which we can ignore? 


On Fri, Jul 7, 2017 at 11:55 AM, Craig Topper <[hidden email]> wrote:
You can use -mllvm -opt-bisect-limit=<limit> to bisect where the error occurs. More documentation here http://llvm.org/docs/OptBisect.html

~Craig

On Thu, Jul 6, 2017 at 11:18 PM, ROHIT KUMAR via cfe-dev <[hidden email]> wrote:
Hey, 

Context: Android native code built with clang using Android Studio.

We have been using GCC(Eclipse) for quite a while, now we are trying to move our huge code base to clang (to AndroidStudio). 

With GCC we were using -O3 optimization and everything was working fine, but with clang, even -O1 is causing Android apps to crash on runtime with the seg fault. 

Since apps are working fine when compiled with -O0, so my guess is some kind of optimization is not supported for our code base which is/are introduced by O1/2/3 flags.

Is there a way I can disable the flags introduced by -O1 one-by-one to figure out the culprit flag(s)?

Can anyone suggest me such flags to disable optimizations one-by-one? I tried googling but could not find much help.

I am stuck on this issue for quite a while now. I would really appreciate the help. I am looking for a more general advice on flags to disable optimizations one-by-one with -O1, because making changes in the code base would not be possible. 

Thanks. 
Rohit Kumar



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



--
~Craig
--
~Craig



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Optimization flags causing segfault on clang

Boris Kolpackov via cfe-dev
In reply to this post by Boris Kolpackov via cfe-dev
This is weird, I ran the build again and this time it showed error at a different location. 
Inline image 1

Please Ignore other emails with the same content. As the image size was larger the mailing group was blocking it, so compresses the image and resent it.

On Fri, Jul 7, 2017 at 1:35 PM, Craig Topper <[hidden email]> wrote:
That's not supposed to happen. What was the failure?

On Fri, Jul 7, 2017 at 1:01 AM ROHIT KUMAR <[hidden email]> wrote:
Yes. With this flag, I got compilation failure.

On Jul 7, 2017 1:28 PM, "Craig Topper" <[hidden email]> wrote:
You got a compilation failure not a runtime failure?

On Fri, Jul 7, 2017 at 12:19 AM ROHIT KUMAR <[hidden email]> wrote:
Thanks, Craig. 

So with this argument, the build failed on compilation with the last log as

"BISECT: NOT running pass (60626) optimize barriers pass on function ... "

It points to a function in a class where we also had a high suspicion for. So it makes sense. 

So it is very likely that the way our code is written is not meeting the standards used by clang and one or other optimization is breaking it.

Do you have any idea which flag is doing this "optimize barriers pass on function" which we can ignore? 


On Fri, Jul 7, 2017 at 11:55 AM, Craig Topper <[hidden email]> wrote:
You can use -mllvm -opt-bisect-limit=<limit> to bisect where the error occurs. More documentation here http://llvm.org/docs/OptBisect.html

~Craig

On Thu, Jul 6, 2017 at 11:18 PM, ROHIT KUMAR via cfe-dev <[hidden email]> wrote:
Hey, 

Context: Android native code built with clang using Android Studio.

We have been using GCC(Eclipse) for quite a while, now we are trying to move our huge code base to clang (to AndroidStudio). 

With GCC we were using -O3 optimization and everything was working fine, but with clang, even -O1 is causing Android apps to crash on runtime with the seg fault. 

Since apps are working fine when compiled with -O0, so my guess is some kind of optimization is not supported for our code base which is/are introduced by O1/2/3 flags.

Is there a way I can disable the flags introduced by -O1 one-by-one to figure out the culprit flag(s)?

Can anyone suggest me such flags to disable optimizations one-by-one? I tried googling but could not find much help.

I am stuck on this issue for quite a while now. I would really appreciate the help. I am looking for a more general advice on flags to disable optimizations one-by-one with -O1, because making changes in the code base would not be possible. 

Thanks. 
Rohit Kumar



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



--
~Craig
--
~Craig


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Optimization flags causing segfault on clang

Boris Kolpackov via cfe-dev
Error is:
Error: r13 not allowed here -- `sub.w sp,r0,#1032'


On Fri, Jul 7, 2017 at 1:59 PM, ROHIT KUMAR <[hidden email]> wrote:
This is weird, I ran the build again and this time it showed error at a different location. 
Inline image 1

Please Ignore other emails with the same content. As the image size was larger the mailing group was blocking it, so compresses the image and resent it.

On Fri, Jul 7, 2017 at 1:35 PM, Craig Topper <[hidden email]> wrote:
That's not supposed to happen. What was the failure?

On Fri, Jul 7, 2017 at 1:01 AM ROHIT KUMAR <[hidden email]> wrote:
Yes. With this flag, I got compilation failure.

On Jul 7, 2017 1:28 PM, "Craig Topper" <[hidden email]> wrote:
You got a compilation failure not a runtime failure?

On Fri, Jul 7, 2017 at 12:19 AM ROHIT KUMAR <[hidden email]> wrote:
Thanks, Craig. 

So with this argument, the build failed on compilation with the last log as

"BISECT: NOT running pass (60626) optimize barriers pass on function ... "

It points to a function in a class where we also had a high suspicion for. So it makes sense. 

So it is very likely that the way our code is written is not meeting the standards used by clang and one or other optimization is breaking it.

Do you have any idea which flag is doing this "optimize barriers pass on function" which we can ignore? 


On Fri, Jul 7, 2017 at 11:55 AM, Craig Topper <[hidden email]> wrote:
You can use -mllvm -opt-bisect-limit=<limit> to bisect where the error occurs. More documentation here http://llvm.org/docs/OptBisect.html

~Craig

On Thu, Jul 6, 2017 at 11:18 PM, ROHIT KUMAR via cfe-dev <[hidden email]> wrote:
Hey, 

Context: Android native code built with clang using Android Studio.

We have been using GCC(Eclipse) for quite a while, now we are trying to move our huge code base to clang (to AndroidStudio). 

With GCC we were using -O3 optimization and everything was working fine, but with clang, even -O1 is causing Android apps to crash on runtime with the seg fault. 

Since apps are working fine when compiled with -O0, so my guess is some kind of optimization is not supported for our code base which is/are introduced by O1/2/3 flags.

Is there a way I can disable the flags introduced by -O1 one-by-one to figure out the culprit flag(s)?

Can anyone suggest me such flags to disable optimizations one-by-one? I tried googling but could not find much help.

I am stuck on this issue for quite a while now. I would really appreciate the help. I am looking for a more general advice on flags to disable optimizations one-by-one with -O1, because making changes in the code base would not be possible. 

Thanks. 
Rohit Kumar



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



--
~Craig
--
~Craig



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Optimization flags causing segfault on clang

Boris Kolpackov via cfe-dev
In reply to this post by Boris Kolpackov via cfe-dev

On Fri, Jul 7, 2017 at 10:29 AM, ROHIT KUMAR via cfe-dev <[hidden email]> wrote:
​(a picture)



​Csaba​

--
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev