[Bug inline-asm/93981] No EH information generated for asm statements
jwjagersma at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Mar 1 19:34:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93981
--- Comment #9 from jwjagersma at gmail dot com ---
ICE can be replicated with:
```
$ ./cc1plus -O -g -fnon-call-exceptions -I../../gcc/libgcc
../../gcc/libgcc/config/i386/sfp-exceptions.c
void __sfp_handle_exceptions(int)
Analyzing compilation unit
Performing interprocedural optimizations
<*free_lang_data> <visibility> <build_ssa_passes>
../../gcc/libgcc/config/i386/sfp-exceptions.c:107:1: error: statement marked
for throw in middle of block
107 | }
| ^
# VUSE <.MEM_31>
__asm__ __volatile__("fdivs %1" : "=t" f_32 : "m" g, "0" f_30);
../../gcc/libgcc/config/i386/sfp-exceptions.c:107:1: error: statement marked
for throw in middle of block
# VUSE <.MEM_46>
__asm__ __volatile__("fdivs %1" : "=t" f_47 : "m" g, "0" f_45);
during GIMPLE pass: ssa
../../gcc/libgcc/config/i386/sfp-exceptions.c:107:1: internal compiler error:
verify_gimple failed
```
The error message is different but it's the same problem.
When I break there in gdb:
```
(gdb) break tree-cfg.c:5439
Breakpoint 5 at 0xf93816: file ../../gcc/gcc/tree-cfg.c, line 5439.
(gdb) r
Starting program: D:\vmshare\gcc-build\gcc\cc1plus.exe -O -g
-fnon-call-exceptions -I../../gcc/libgcc
../../gcc/libgcc/config/i386/sfp-exceptions.c
void __sfp_handle_exceptions(int)
Analyzing compilation unit
Performing interprocedural optimizations
<*free_lang_data> <visibility> <build_ssa_passes>
Breakpoint 5, verify_gimple_in_cfg (fn=0x3b9e10b8,
verify_nothrow=verify_nothrow@entry=true) at ../../gcc/gcc/tree-cfg.c:5439
warning: Source file is more recent than executable.
5439 error ("statement marked for throw in middle of
block");
=> 0x0000000000f93816 <verify_gimple_in_cfg(function*, bool)+1249>: 48 8d
0d 83 44 1c 01 lea rcx,[rip+0x11c4483] #0x2157ca0 <(anonymous
namespace)::pass_data_call_cdce+14848>
0x0000000000f9381d <verify_gimple_in_cfg(function*, bool)+1256>: e8 86
00 de 00 call 0x1d738a8 <error(char const*, ...)>
(gdb) pp bb
<bb 10> :
# DEBUG BEGIN_STMT
f_30 = 1.0e+0;
# DEBUG f => f_30
g = 0.0;
# DEBUG BEGIN_STMT
__asm__ __volatile__("fdivs %1" : "=t" f_32 : "m" g, "0" f_30);
# DEBUG f => f_32
(gdb) c
Continuing.
../../gcc/libgcc/config/i386/sfp-exceptions.c:107:1: error: statement marked
for throw in middle of block
107 | }
| ^
# VUSE <.MEM_31>
__asm__ __volatile__("fdivs %1" : "=t" f_32 : "m" g, "0" f_30);
Breakpoint 5, verify_gimple_in_cfg (fn=0x3b9e10b8,
verify_nothrow=verify_nothrow@entry=true) at ../../gcc/gcc/tree-cfg.c:5439
5439 error ("statement marked for throw in middle of
block");
=> 0x0000000000f93816 <verify_gimple_in_cfg(function*, bool)+1249>: 48 8d
0d 83 44 1c 01 lea rcx,[rip+0x11c4483] #0x2157ca0 <(anonymous
namespace)::pass_data_call_cdce+14848>
0x0000000000f9381d <verify_gimple_in_cfg(function*, bool)+1256>: e8 86
00 de 00 call 0x1d738a8 <error(char const*, ...)>
(gdb) pp bb
<bb 23> :
# DEBUG BEGIN_STMT
f_45 = 1.0e+0;
# DEBUG f => f_45
g = 3.0e+0;
# DEBUG BEGIN_STMT
__asm__ __volatile__("fdivs %1" : "=t" f_47 : "m" g, "0" f_45);
# DEBUG f => f_47
```
So the problem is that DEBUG stmts are inserted after a throwing asm.
More information about the Gcc-bugs
mailing list