public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/110556] New: Floating point exception with specific optimizations
@ 2023-07-05  9:19 19373742 at buaa dot edu.cn
  2023-07-05  9:20 ` [Bug c/110556] " 19373742 at buaa dot edu.cn
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: 19373742 at buaa dot edu.cn @ 2023-07-05  9:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

            Bug ID: 110556
           Summary: Floating point exception with specific optimizations
           Product: gcc
           Version: 13.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 19373742 at buaa dot edu.cn
  Target Milestone: ---

Created attachment 55473
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55473&action=edit
The preprocessed file

*******************************************************************************
OS and Platform:
CentOS Linux release 7.9.2009 (Core), x86_64 GNU/Linux
*******************************************************************************
gcc version:
gcc -v
Using built-in specs.
COLLECT_GCC=/home/gcc-releases/gcc-13-0701/bin/gcc
COLLECT_LTO_WRAPPER=/home/gcc-releases/gcc-13-0701/libexec/gcc/x86_64-pc-linux-gnu/13.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/home/gcc-releases/gcc-13-0701/
--disable-multilib --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.1 20230701 (GCC)
*******************************************************************************
Command Lines:
# gcc -I /home/csmith/include/csmith-2.3.0/ -O3
-fno-aggressive-loop-optimizations -fno-align-functions -fno-align-jumps
-fno-align-labels -fno-align-loops -fno-allocation-dce
-fno-asynchronous-unwind-tables -fno-auto-inc-dec -fno-bit-tests
-fno-branch-count-reg -fno-caller-saves -fno-code-hoisting
-fno-combine-stack-adjustments -fno-compare-elim -fno-cprop-registers
-fno-crossjumping -fno-cse-follow-jumps -fno-dce -fno-defer-pop
-fno-devirtualize -fno-devirtualize-speculatively -fno-dse -fno-early-inlining
-fno-expensive-optimizations -fno-forward-propagate -fno-fp-int-builtin-inexact
-fno-function-cse -fno-gcse -fno-gcse-after-reload -fno-gcse-lm
-fno-guess-branch-probability -fno-hoist-adjacent-loads -fno-if-conversion
-fno-if-conversion2 -fno-indirect-inlining -fno-inline -fno-inline-atomics
-fno-inline-functions -fno-inline-functions-called-once
-fno-inline-small-functions -fno-ipa-bit-cp -fno-ipa-cp -fno-ipa-cp-clone
-fno-ipa-icf -fno-ipa-icf-functions -fno-ipa-icf-variables -fno-ipa-modref
-fno-ipa-profile -fno-ipa-pure-const -fno-ipa-ra -fno-ipa-reference
-fno-ipa-reference-addressable -fno-ipa-sra -fno-ipa-stack-alignment
-fno-ipa-strict-aliasing -fno-ipa-vrp -fno-ira-hoist-pressure
-fno-ira-share-save-slots -fno-ira-share-spill-slots
-fno-isolate-erroneous-paths-dereference -fno-ivopts -fno-jump-tables
-fno-lifetime-dse -fno-loop-interchange -fno-loop-unroll-and-jam -fno-lra-remat
-fno-math-errno -fno-move-loop-invariants -fno-move-loop-stores
-fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-optimize-strlen
-fno-partial-inlining -fno-peel-loops -fno-peephole -fno-peephole2 -fno-plt
-fno-predictive-commoning -fno-printf-return-value -fno-ree
-fno-reg-struct-return -fno-reorder-blocks -fno-reorder-blocks-and-partition
-fno-reorder-functions -fno-rerun-cse-after-loop
-fno-sched-critical-path-heuristic -fno-sched-dep-count-heuristic
-fno-sched-group-heuristic -fno-sched-interblock -fno-sched-last-insn-heuristic
-fno-sched-rank-heuristic -fno-sched-spec -fno-sched-spec-insn-heuristic
-fno-sched-stalled-insns-dep -fno-schedule-fusion -fno-schedule-insns2
-fno-semantic-interposition -fno-short-enums -fno-shrink-wrap
-fno-shrink-wrap-separate -fno-signed-zeros -fno-split-ivs-in-unroller
-fno-split-loops -fno-split-paths -fno-split-wide-types -fno-ssa-backprop
-fno-ssa-phiopt -fno-stdarg-opt -fno-store-merging -fno-strict-aliasing
-fno-thread-jumps -fno-toplevel-reorder -fno-trapping-math -fno-tree-bit-ccp
-fno-tree-builtin-call-dce -fno-tree-ccp -fno-tree-ch -fno-tree-coalesce-vars
-fno-tree-copy-prop -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse
-fno-tree-forwprop -fno-tree-fre -fno-tree-loop-distribute-patterns
-fno-tree-loop-distribution -fno-tree-loop-im -fno-tree-loop-ivcanon
-fno-tree-loop-optimize -fno-tree-loop-vectorize -fno-tree-partial-pre
-fno-tree-phiprop -fno-tree-pre -fno-tree-pta -fno-tree-reassoc
-fno-tree-scev-cprop -fno-tree-sink -fno-tree-slp-vectorize -fno-tree-slsr
-fno-tree-sra -fno-tree-switch-conversion -fno-tree-tail-merge -fno-tree-ter
-fno-tree-vrp -fno-unroll-completely-grow-size -fno-unroll-loops
-fno-unswitch-loops -fno-unwind-tables -fno-version-loops-for-strides
-fno-allow-store-data-races -fno-associative-math -fno-branch-probabilities
-fno-conserve-stack -fno-cx-fortran-rules -fno-cx-limited-range
-fno-delayed-branch -fno-delete-dead-exceptions -fno-finite-loops
-fno-finite-math-only -fno-float-store -fno-gcse-las -fno-gcse-sm -fno-graphite
-fno-graphite-identity -fno-harden-compares -fno-harden-conditional-branches
-fno-ipa-pta -fno-ira-loop-pressure -fno-isolate-erroneous-paths-attribute
-fno-keep-gc-roots-live -fno-limit-function-alignment -fno-live-range-shrinkage
-fno-loop-nest-optimize -fno-loop-parallelize-all -fno-modulo-sched
-fno-modulo-sched-allow-regmoves -fno-non-call-exceptions -fno-opt-info
-fno-pack-struct -fno-profile-partial-training -fno-profile-reorder-functions
-fno-reciprocal-math -fno-rename-registers
-fno-reschedule-modulo-scheduled-loops -fno-rounding-math
-fno-save-optimization-record -fno-sched-pressure -fno-sched-spec-load
-fno-sched-spec-load-dangerous -fno-sched-stalled-insns
-fno-sched2-use-superblocks -fno-schedule-insns -fno-section-anchors
-fno-sel-sched-pipelining -fno-sel-sched-pipelining-outer-loops
-fno-sel-sched-reschedule-pipelined -fno-short-wchar -fno-signaling-nans
-fno-single-precision-constant -fno-split-wide-types-early
-fno-stack-clash-protection -fno-tracer -fno-trapv -fno-tree-cselim
-fno-tree-lrs -fno-tree-vectorize -fno-unconstrained-commons
-fno-unreachable-traps -fno-unroll-all-loops -fno-unsafe-math-optimizations
-fno-var-tracking -fno-var-tracking-assignments
-fno-var-tracking-assignments-toggle -fno-var-tracking-uninit
-fno-variable-expansion-in-unroller -fno-vpt -fno-web -fno-wrapv
-fno-wrapv-pointer -gno-statement-frontiers -fno-aggressive-loop-optimizations
-falign-functions -fno-align-jumps -falign-labels -fno-align-loops
-fno-allocation-dce -fasynchronous-unwind-tables -fno-auto-inc-dec
-fno-bit-tests -fbranch-count-reg -fcaller-saves -fcode-hoisting
-fno-combine-stack-adjustments -fno-compare-elim -fcprop-registers
-fno-crossjumping -fno-cse-follow-jumps -fdce -fno-defer-pop -fno-devirtualize
-fno-devirtualize-speculatively -fdse -fno-early-inlining
-fexpensive-optimizations -fforward-propagate -fno-fp-int-builtin-inexact
-fno-function-cse -fno-gcse -fgcse-after-reload -fgcse-lm
-fno-guess-branch-probability -fhoist-adjacent-loads -fif-conversion
-fno-if-conversion2 -fno-indirect-inlining -finline -finline-atomics
-fno-inline-functions -fno-inline-functions-called-once
-finline-small-functions -fno-ipa-bit-cp -fipa-cp -fno-ipa-cp-clone
-fno-ipa-icf -fno-ipa-icf-functions -fipa-icf-variables -fipa-modref
-fno-ipa-profile -fipa-pure-const -fipa-ra -fno-ipa-reference
-fno-ipa-reference-addressable -fipa-sra -fno-ipa-stack-alignment
-fno-ipa-strict-aliasing -fno-ipa-vrp -fira-hoist-pressure
-fno-ira-share-save-slots -fira-share-spill-slots
-fno-isolate-erroneous-paths-dereference -fno-ivopts -fno-jump-tables
-fno-lifetime-dse -floop-interchange -fno-loop-unroll-and-jam -flra-remat
-fmath-errno -fmove-loop-invariants -fno-move-loop-stores -fomit-frame-pointer
-fno-optimize-sibling-calls -fno-optimize-strlen -fno-partial-inlining
-fno-peel-loops -fpeephole -fpeephole2 -fno-plt -fno-predictive-commoning
-fprintf-return-value -fno-ree -freg-struct-return -fno-reorder-blocks
-fno-reorder-blocks-and-partition -fno-reorder-functions -frerun-cse-after-loop
-fno-sched-critical-path-heuristic -fno-sched-dep-count-heuristic
-fno-sched-group-heuristic -fno-sched-interblock -fsched-last-insn-heuristic
-fno-sched-rank-heuristic -fsched-spec -fsched-spec-insn-heuristic
-fsched-stalled-insns-dep -fno-schedule-fusion -fno-schedule-insns2
-fno-semantic-interposition -fshort-enums -fshrink-wrap
-fno-shrink-wrap-separate -fno-signed-zeros -fsplit-ivs-in-unroller
-fno-split-loops -fsplit-paths -fsplit-wide-types -fno-ssa-backprop
-fno-ssa-phiopt -fno-stdarg-opt -fstore-merging -fno-strict-aliasing
-fthread-jumps -ftoplevel-reorder -ftrapping-math -ftree-bit-ccp
-fno-tree-builtin-call-dce -fno-tree-ccp -ftree-ch -fno-tree-coalesce-vars
-fno-tree-copy-prop -ftree-dce -ftree-dominator-opts -fno-tree-dse
-ftree-forwprop -fno-tree-fre -fno-tree-loop-distribute-patterns
-fno-tree-loop-distribution -ftree-loop-im -fno-tree-loop-ivcanon
-ftree-loop-optimize -ftree-loop-vectorize -fno-tree-partial-pre -ftree-phiprop
-ftree-pre -ftree-pta -ftree-reassoc -ftree-scev-cprop -fno-tree-sink
-fno-tree-slp-vectorize -fno-tree-slsr -ftree-sra -ftree-switch-conversion
-ftree-tail-merge -fno-tree-ter -fno-tree-vrp -funroll-completely-grow-size
-fno-unroll-loops -fno-unswitch-loops -funwind-tables
-fno-version-loops-for-strides -fno-allow-store-data-races -fassociative-math
-fno-branch-probabilities -fconserve-stack -fno-cx-fortran-rules
-fcx-limited-range -fdelayed-branch -fno-delete-dead-exceptions -ffinite-loops
-ffinite-math-only -fno-float-store -fno-gcse-las -fno-gcse-sm -fgraphite
-fgraphite-identity -fno-harden-compares -fharden-conditional-branches
-fipa-pta -fira-loop-pressure -fno-isolate-erroneous-paths-attribute
-fno-keep-gc-roots-live -fno-limit-function-alignment -fno-live-range-shrinkage
-floop-nest-optimize -floop-parallelize-all -fmodulo-sched
-fno-modulo-sched-allow-regmoves -fnon-call-exceptions -fopt-info
-fno-pack-struct -fprofile-partial-training -fprofile-reorder-functions
-freciprocal-math -fno-rename-registers -fno-reschedule-modulo-scheduled-loops
-fno-rounding-math -fno-save-optimization-record -fno-sched-pressure
-fno-sched-spec-load -fno-sched-spec-load-dangerous -fno-sched-stalled-insns
-fsched2-use-superblocks -fno-schedule-insns -fsection-anchors
-fsel-sched-pipelining -fsel-sched-pipelining-outer-loops
-fno-sel-sched-reschedule-pipelined -fshort-wchar -fno-signaling-nans
-fsingle-precision-constant -fsplit-wide-types-early -fstack-clash-protection
-fno-tracer -ftrapv -ftree-cselim -fno-tree-lrs -ftree-vectorize
-fno-unconstrained-commons -fno-unreachable-traps -fno-unroll-all-loops
-funsafe-math-optimizations -fvar-tracking -fvar-tracking-assignments
-fvar-tracking-assignments-toggle -fno-var-tracking-uninit
-fvariable-expansion-in-unroller -fvpt -fweb -fwrapv -fwrapv-pointer
-gno-statement-frontiers -save-temp ./ec.c -o ec.o 2>ec.out

# gcc -I /home/csmith/include/csmith-2.3.0/ ./ec.c -o ec2.o

# ./ec.o
Floating point exception

# ./ec2.o
checksum = 88F29BC2

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c/110556] Floating point exception with specific optimizations
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
@ 2023-07-05  9:20 ` 19373742 at buaa dot edu.cn
  2023-07-05 10:30 ` 19373742 at buaa dot edu.cn
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: 19373742 at buaa dot edu.cn @ 2023-07-05  9:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

--- Comment #1 from CTC <19373742 at buaa dot edu.cn> ---
Created attachment 55474
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55474&action=edit
The compiler output

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c/110556] Floating point exception with specific optimizations
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
  2023-07-05  9:20 ` [Bug c/110556] " 19373742 at buaa dot edu.cn
@ 2023-07-05 10:30 ` 19373742 at buaa dot edu.cn
  2023-07-05 17:54 ` pinskia at gcc dot gnu.org
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: 19373742 at buaa dot edu.cn @ 2023-07-05 10:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

--- Comment #2 from CTC <19373742 at buaa dot edu.cn> ---
The reduced sequence:

-O3 -fno-inline-small-functions -fno-tree-fre -fno-delete-dead-exceptions
-fexpensive-optimizations -fipa-pure-const -fipa-sra -fthread-jumps -ftree-dce
-ftree-dominator-opts -ftree-forwprop -ftree-pre -ftree-tail-merge
-fnon-call-exceptions

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c/110556] Floating point exception with specific optimizations
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
  2023-07-05  9:20 ` [Bug c/110556] " 19373742 at buaa dot edu.cn
  2023-07-05 10:30 ` 19373742 at buaa dot edu.cn
@ 2023-07-05 17:54 ` pinskia at gcc dot gnu.org
  2023-07-05 21:28 ` [Bug middle-end/110556] " pinskia at gcc dot gnu.org
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-05 17:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is a division by 0 being kept around ...

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug middle-end/110556] Floating point exception with specific optimizations
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
                   ` (2 preceding siblings ...)
  2023-07-05 17:54 ` pinskia at gcc dot gnu.org
@ 2023-07-05 21:28 ` pinskia at gcc dot gnu.org
  2023-07-05 22:32 ` pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-05 21:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reducing this but it is taking a little longer as I get to the case where we
get undefined code on accident so I need to test it using
-fsanitize=undefined,address also.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug middle-end/110556] Floating point exception with specific optimizations
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
                   ` (3 preceding siblings ...)
  2023-07-05 21:28 ` [Bug middle-end/110556] " pinskia at gcc dot gnu.org
@ 2023-07-05 22:32 ` pinskia at gcc dot gnu.org
  2023-07-06  1:36 ` 19373742 at buaa dot edu.cn
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-05 22:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #4)
> Reducing this but it is taking a little longer as I get to the case where we
> get undefined code on accident so I need to test it using
> -fsanitize=undefined,address also.

The reduction I got still got an unintialized variable in it ...

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug middle-end/110556] Floating point exception with specific optimizations
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
                   ` (4 preceding siblings ...)
  2023-07-05 22:32 ` pinskia at gcc dot gnu.org
@ 2023-07-06  1:36 ` 19373742 at buaa dot edu.cn
  2023-07-06  1:38 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: 19373742 at buaa dot edu.cn @ 2023-07-06  1:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

--- Comment #6 from CTC <19373742 at buaa dot edu.cn> ---
(In reply to Andrew Pinski from comment #4)
> Reducing this but it is taking a little longer as I get to the case where we
> get undefined code on accident so I need to test it using
> -fsanitize=undefined,address also.

For the unreduced program and optimizations, I test it with
-fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations and
-fsanitize=undefined. Both of them got floating point exception too.

I reduced the program with -fsanitize=undefined. The result doesn't get
floating point exception. But its return value is not 0.

# gcc-13 -I /root/csmith/include/csmith-2.3.0/ -O3 -fno-inline-small-functions
-fno-tree-fre -fno-delete-dead-exceptions -fexpensive-optimizations
-fipa-pure-const -fipa-sra -fthread-jumps -ftree-dce -ftree-dominator-opts
-ftree-forwprop -ftree-pre -ftree-tail-merge -fnon-call-exceptions
-fsanitize=undefined -o fails.o testcase.i -Wfatal-errors
# ./fails.o
# echo $?
64

# gcc-13 -I /root/autodl-fs/csmith/include/csmith-2.3.0/ -o works testcase.i
-Wfatal-errors
# ./works
# echo $?
0

# cat testcase.i
int a;
void main() { int b = a;}

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug middle-end/110556] Floating point exception with specific optimizations
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
                   ` (5 preceding siblings ...)
  2023-07-06  1:36 ` 19373742 at buaa dot edu.cn
@ 2023-07-06  1:38 ` pinskia at gcc dot gnu.org
  2023-07-06  5:30 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-06  1:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to CTC from comment #6)
> (In reply to Andrew Pinski from comment #4)
> > Reducing this but it is taking a little longer as I get to the case where we
> > get undefined code on accident so I need to test it using
> > -fsanitize=undefined,address also.
> 
> For the unreduced program and optimizations, I test it with
> -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations and
> -fsanitize=undefined. Both of them got floating point exception too.
> 
> I reduced the program with -fsanitize=undefined. The result doesn't get
> floating point exception. But its return value is not 0.

That is still undefined code ... as the return value of the app is not
specified in the source.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug middle-end/110556] Floating point exception with specific optimizations
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
                   ` (6 preceding siblings ...)
  2023-07-06  1:38 ` pinskia at gcc dot gnu.org
@ 2023-07-06  5:30 ` pinskia at gcc dot gnu.org
  2023-07-06  5:42 ` [Bug middle-end/110556] [12/13/14 Regression] " pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-06  5:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55485
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55485&action=edit
Reduced testcase

Compile with ` -O2  -fno-tree-fre -fno-delete-dead-exceptions
-fnon-call-exceptions` to make sure the division stays around.

Note the interesting thing is if I remove the loop in func_6, the code
generation for safe_mul_func_int64_t_s_s changes (to be correct). (that is just
call func_34/func_30 in func_6).

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug middle-end/110556] [12/13/14 Regression] Floating point exception with specific optimizations
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
                   ` (7 preceding siblings ...)
  2023-07-06  5:30 ` pinskia at gcc dot gnu.org
@ 2023-07-06  5:42 ` pinskia at gcc dot gnu.org
  2023-07-06  8:15 ` [Bug tree-optimization/110556] [12/13/14 Regression] division of INT_MIN and -1 happening incorrectly with -fno-delete-dead-exceptions -fnon-call-exceptions rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-06  5:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Target Milestone|---                         |12.4
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
            Summary|Floating point exception    |[12/13/14 Regression]
                   |with specific optimizations |Floating point exception
                   |                            |with specific optimizations
      Known to work|                            |11.1.0
   Last reconfirmed|                            |2023-07-06
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=100394
      Known to fail|                            |12.1.0

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

Note I think this is a latent bug, which was exposed with
r12-475-g8ebf6b99952ada09bf9ea .

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug tree-optimization/110556] [12/13/14 Regression] division of INT_MIN and -1 happening incorrectly with -fno-delete-dead-exceptions -fnon-call-exceptions
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
                   ` (8 preceding siblings ...)
  2023-07-06  5:42 ` [Bug middle-end/110556] [12/13/14 Regression] " pinskia at gcc dot gnu.org
@ 2023-07-06  8:15 ` rguenth at gcc dot gnu.org
  2023-07-06 11:45 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-06  8:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Needs investigation on what actually does an invalid transform. 
-fno-thread-jumps avoids the issue.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug tree-optimization/110556] [12/13/14 Regression] division of INT_MIN and -1 happening incorrectly with -fno-delete-dead-exceptions -fnon-call-exceptions
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
                   ` (9 preceding siblings ...)
  2023-07-06  8:15 ` [Bug tree-optimization/110556] [12/13/14 Regression] division of INT_MIN and -1 happening incorrectly with -fno-delete-dead-exceptions -fnon-call-exceptions rguenth at gcc dot gnu.org
@ 2023-07-06 11:45 ` rguenth at gcc dot gnu.org
  2023-07-06 13:24 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-06 11:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is tail merging and I think we have a duplicate bug for this.

find_duplicates: <bb 5> duplicate of <bb 7>
Removing basic block 7
;; basic block 7, loop depth 0
;;  pred:
_27 = -9223372036854775808 / si2_15(D);
goto <bb 10>; [100.00%]

and we have

  <bb 4> [local count: 268435457]:
  _5 = si2_15(D) > 0;
  _6 = _1 | _5;
  if (_6 != 0)
    goto <bb 6>; [20.00%]
  else
    goto <bb 5>; [80.00%]

  <bb 5> [local count: 214748365]:
  _13 = -9223372036854775808 / si1_14(D);
  goto <bb 10>; [100.00%]

  <bb 6> [local count: 301989889]:
  _7 = si1_14(D) > 0;
  _9 = _2 | _7;
  if (_9 != 0)
    goto <bb 8>; [0.00%]
  else
    goto <bb 7>; [100.00%]

  <bb 7> [local count: 301989888]:
  _27 = -9223372036854775808 / si2_15(D);
  goto <bb 10>; [100.00%]

oddly enough gimple_equal_p looks strange:

    case GIMPLE_ASSIGN:
      lhs1 = gimple_get_lhs (s1);
      lhs2 = gimple_get_lhs (s2);
      if (TREE_CODE (lhs1) != SSA_NAME
          && TREE_CODE (lhs2) != SSA_NAME)
        return (operand_equal_p (lhs1, lhs2, 0)
                && gimple_operand_equal_value_p (gimple_assign_rhs1 (s1),
                                                 gimple_assign_rhs1 (s2)));
      else if (TREE_CODE (lhs1) == SSA_NAME
               && TREE_CODE (lhs2) == SSA_NAME)
        return operand_equal_p (gimple_assign_rhs1 (s1),
                                gimple_assign_rhs1 (s2), 0);

that looks pre-tuplish to me.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug tree-optimization/110556] [12/13/14 Regression] division of INT_MIN and -1 happening incorrectly with -fno-delete-dead-exceptions -fnon-call-exceptions
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
                   ` (10 preceding siblings ...)
  2023-07-06 11:45 ` rguenth at gcc dot gnu.org
@ 2023-07-06 13:24 ` cvs-commit at gcc dot gnu.org
  2023-07-07 12:07 ` [Bug tree-optimization/110556] [12 " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-06 13:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:7b16686ef882ab141276f0e36a9d4ce1d755f64a

commit r14-2363-g7b16686ef882ab141276f0e36a9d4ce1d755f64a
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jul 6 13:51:55 2023 +0200

    tree-optimization/110556 - tail merging still pre-tuples

    The stmt comparison function for GIMPLE_ASSIGNs for tail merging
    still looks like it deals with pre-tuples IL.  The following
    attempts to fix this, not only comparing the first operand (sic!)
    of stmts but all of them plus also compare the operation code.

            PR tree-optimization/110556
            * tree-ssa-tail-merge.cc (gimple_equal_p): Check
            assign code and all operands of non-stores.

            * gcc.dg/torture/pr110556.c: New testcase.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug tree-optimization/110556] [12 Regression] division of INT_MIN and -1 happening incorrectly with -fno-delete-dead-exceptions -fnon-call-exceptions
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
                   ` (11 preceding siblings ...)
  2023-07-06 13:24 ` cvs-commit at gcc dot gnu.org
@ 2023-07-07 12:07 ` cvs-commit at gcc dot gnu.org
  2023-11-27 11:35 ` cvs-commit at gcc dot gnu.org
  2023-11-27 11:36 ` rguenth at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-07 12:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:45e950b542ca598eb8a4a69305fdd96dcb603353

commit r13-7546-g45e950b542ca598eb8a4a69305fdd96dcb603353
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jul 6 13:51:55 2023 +0200

    tree-optimization/110556 - tail merging still pre-tuples

    The stmt comparison function for GIMPLE_ASSIGNs for tail merging
    still looks like it deals with pre-tuples IL.  The following
    attempts to fix this, not only comparing the first operand (sic!)
    of stmts but all of them plus also compare the operation code.

            PR tree-optimization/110556
            * tree-ssa-tail-merge.cc (gimple_equal_p): Check
            assign code and all operands of non-stores.

            * gcc.dg/torture/pr110556.c: New testcase.

    (cherry picked from commit 7b16686ef882ab141276f0e36a9d4ce1d755f64a)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug tree-optimization/110556] [12 Regression] division of INT_MIN and -1 happening incorrectly with -fno-delete-dead-exceptions -fnon-call-exceptions
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
                   ` (12 preceding siblings ...)
  2023-07-07 12:07 ` [Bug tree-optimization/110556] [12 " cvs-commit at gcc dot gnu.org
@ 2023-11-27 11:35 ` cvs-commit at gcc dot gnu.org
  2023-11-27 11:36 ` rguenth at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-27 11:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:34bb7282da434e43d29f35733121d8c08a7a1ae1

commit r12-10008-g34bb7282da434e43d29f35733121d8c08a7a1ae1
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jul 6 13:51:55 2023 +0200

    tree-optimization/110556 - tail merging still pre-tuples

    The stmt comparison function for GIMPLE_ASSIGNs for tail merging
    still looks like it deals with pre-tuples IL.  The following
    attempts to fix this, not only comparing the first operand (sic!)
    of stmts but all of them plus also compare the operation code.

            PR tree-optimization/110556
            * tree-ssa-tail-merge.cc (gimple_equal_p): Check
            assign code and all operands of non-stores.

            * gcc.dg/torture/pr110556.c: New testcase.

    (cherry picked from commit 7b16686ef882ab141276f0e36a9d4ce1d755f64a)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug tree-optimization/110556] [12 Regression] division of INT_MIN and -1 happening incorrectly with -fno-delete-dead-exceptions -fnon-call-exceptions
  2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
                   ` (13 preceding siblings ...)
  2023-11-27 11:35 ` cvs-commit at gcc dot gnu.org
@ 2023-11-27 11:36 ` rguenth at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-27 11:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110556

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |12.3.0
      Known to work|                            |12.3.1
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-11-27 11:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-05  9:19 [Bug c/110556] New: Floating point exception with specific optimizations 19373742 at buaa dot edu.cn
2023-07-05  9:20 ` [Bug c/110556] " 19373742 at buaa dot edu.cn
2023-07-05 10:30 ` 19373742 at buaa dot edu.cn
2023-07-05 17:54 ` pinskia at gcc dot gnu.org
2023-07-05 21:28 ` [Bug middle-end/110556] " pinskia at gcc dot gnu.org
2023-07-05 22:32 ` pinskia at gcc dot gnu.org
2023-07-06  1:36 ` 19373742 at buaa dot edu.cn
2023-07-06  1:38 ` pinskia at gcc dot gnu.org
2023-07-06  5:30 ` pinskia at gcc dot gnu.org
2023-07-06  5:42 ` [Bug middle-end/110556] [12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-07-06  8:15 ` [Bug tree-optimization/110556] [12/13/14 Regression] division of INT_MIN and -1 happening incorrectly with -fno-delete-dead-exceptions -fnon-call-exceptions rguenth at gcc dot gnu.org
2023-07-06 11:45 ` rguenth at gcc dot gnu.org
2023-07-06 13:24 ` cvs-commit at gcc dot gnu.org
2023-07-07 12:07 ` [Bug tree-optimization/110556] [12 " cvs-commit at gcc dot gnu.org
2023-11-27 11:35 ` cvs-commit at gcc dot gnu.org
2023-11-27 11:36 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).