https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80088
Bug ID: 80088 Summary: ICE: declaration and definition of function with __attribute__((target("thumb"))) and inlined assembler, with debug symbols enabled Product: gcc Version: 5.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: wojtek.golf at interia dot pl Target Milestone: --- Snippet below, when compiled with arm hard-float crosscompiler, causes ICE. void __attribute(( target("thumb") )) bar(); int main() { return 0; } void bar() { unsigned int foo; asm ("mcr p15, 0, %0, c13, c0, 3" : : "r" (foo) ); } 1. commenting out main function make the problem disappears 2. when the definition is moved before main the problem disappears 3. when the target attribute is changed to arm the problem disappears 4. when the inline assembler is replaced with asm(" mcr 15, 0, r3, cr13, cr0, {3}"); the problem disappears Invocation command: arm-linux-gnueabihf-gcc -g -marm ice3.c -c 1. -g and -marm flags are mandatory, either one of them missing make the problem disappear 2. -c can be replaced with -S The compiler crashes with the following output to the console: $ arm-linux-gnueabihf-gcc -g -marm ice3.c -S ice3.c: In function ‘bar’: ice3.c:16:1: internal compiler error: in dwarf2out_frame_debug_adjust_cfa, at dwarf2cfi.c:1169 } ^ Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions. Environment: OS: Ubuntu 16.04.04 $ uname -a Linux wojtek-dell 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux $ $ arm-linux-gnueabihf-gcc --version arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.