[cfe-dev] Fwd: SIGILL with clang

Raphael Isemann via cfe-dev cfe-dev at lists.llvm.org
Sat Aug 26 03:32:00 PDT 2017


Glad to help. CCing ML for the record.

On Aug 26, 2017 12:24 PM, "ROHIT KUMAR" <rohitpoddar92 at gmail.com> wrote:

It is as you mentioned. The missing return statement in a function very
much similar to your example. Adding it fixed the issue

So, it seems Clang is a little too strict as compared to GCC. I faced many
issues earlier and all of them ended up being related to flags, I didn't
expect the issue to be this simple.

Thanks for your help





On Sat, Aug 26, 2017 at 3:14 PM, Raphael Isemann <teemperor at gmail.com>
wrote:

> On a side note that is probably too simple for the ML: Did you check
> for missing return statements in the called/callee function? For a
> missing return clang generates SIGILL while GCC is returning something
> ABI-dependent IIRC.
>
> E.g. this causes SIGILL on clang and runs just fine on GCC:
> ```
> int foo(int i) {
>  if(i) {
>    return 1;
>  }
> }
>
> int main() {
>  foo(0);
> }
> ```
>
> - Raphael
>
> 2017-08-26 10:34 GMT+02:00 ROHIT KUMAR via cfe-dev <cfe-dev at lists.llvm.org
> >:
> > Hey folks,
> >
> > I am migrating our huge Android code base from GCC(Eclipse IDE) to
> > clang(Android Studio).
> >
> > Error: SIGILL (signal SIGILL: illegal instruction)
> >
> > At a weird line in the code, I am getting this error. which points to a
> > closing curly bracket of an if condition. After googling, I am assuming
> it
> > is some kind of architecture flag issue. I am using same flags which were
> > used for GCC.
> >
> > Note: I am currently working on Arm build.
> >
> > Here are the architecture flags for ARM7:
> >
> > -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mtune=cortex-a8
> -mthumb
> > -DTARGET_THUMB2
> >
> > Can anyone help me debug this issue? Is there any issue with the flags
> with
> > clang?
> >
> > Thanks,
> > Rohit Kumar
> >
> >
> >
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170826/bd83f0e7/attachment.html>


More information about the cfe-dev mailing list