[Bug middle-end/19020] libcalls are removed (-ftrapv does not work)

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jan 17 15:35:00 GMT 2007



------- Comment #5 from rguenth at gcc dot gnu dot org  2007-01-17 15:35 -------
There are a few issues, first we use emit_libcall_block to emit the trapping
PLUS
which sets a REG_EQUAL note with a non-trapping PLUS.

Second we analyze iaddv as not possibly throwing so we remove the call from
main()
during tree optimization as the result is unused.

Third, we widen the integer addition to DImode and dispatch to libgcc2
__addvdi3
which looks like

Dump of assembler code for function __addvdi3:
0x0000000000400580 <__addvdi3+0>:       sub    $0x8,%rsp
0x0000000000400584 <__addvdi3+4>:       test   %rsi,%rsi
0x0000000000400587 <__addvdi3+7>:       lea    (%rdi,%rsi,1),%rax
0x000000000040058b <__addvdi3+11>:      js     0x4005a0 <__addvdi3+32>
0x000000000040058d <__addvdi3+13>:      cmp    %rax,%rdi

so it tests for 64bit overflow instead of 32bit one.  Obviously allowind
LIBCALL_WIDEN is wrong for the trapping optabs, too.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
           Keywords|                            |wrong-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020



More information about the Gcc-bugs mailing list