Bug#665499: clang: code using std::stack crashes with SIGILL when compiled with clang++

Robert Luberda robert at debian.org
Sun Mar 25 22:42:55 UTC 2012


Sylvestre Ledru wrote:

Hi,

> Le samedi 24 mars 2012 à 19:23 +0100, Robert Luberda a écrit :
>> Package: clang
>> Version: 3.0-6
>> Severity: normal
>>
>>    [21]/tmp> clang++ -ggdb  test.cpp -o testcrash
>>    [22]/tmp> ./testcrash
>>    Illegal instruction (core dumped)
> ??
> Is there anything special I should now about your system ?

Yes, my system is not pentium4 (it's quite an old AMD sempron instead)
and I've just discovered that this is the reason of the issue. The
`clang++ -v' output I sent previously, contains the `-target-cpu pentium4'.

It seems that pentium4 is chosen as a default one by
Clang::AddX86TargetArgs() function in /tools/clang/lib/Driver/Tools.cpp:
   if (getToolChain().getArch() == llvm::Triple::x86_64)
        CPUName = "x86-64";
      else if (getToolChain().getArch() == llvm::Triple::x86)
        CPUName = "pentium4";


Anyway, the program I sent yesterday works correctly if I pass
-march=i686 option to clang. It works also with any previous arch like
i586 or i386 and with -march=native, in which case clang++ -v shows
`-target-cpu athlon-mp'

Regards,
robert





More information about the Pkg-llvm-team mailing list