Bug 110169 - wrong code with '-Ofast'
Summary: wrong code with '-Ofast'
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 14.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: needs-reduction
Depends on:
Blocks:
 
Reported: 2023-06-08 10:32 UTC by CTC
Modified: 2023-06-11 09:18 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
The preprocessed file (34.20 KB, text/plain)
2023-06-08 10:32 UTC, CTC
Details
The compiler output (2.25 KB, text/plain)
2023-06-08 10:33 UTC, CTC
Details

Note You need to log in before you can comment on or make changes to this bug.
Description CTC 2023-06-08 10:32:55 UTC
Created attachment 55282 [details]
The preprocessed file

*******************************************************************************
OS and Platform:
CentOS Linux release 7.9.2009 (Core), x86_64 GNU/Linux
*******************************************************************************
gcc version:
# /home/gcc-releases/gcc-14-0604/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/home/gcc-releases/gcc-14-0604/bin/gcc
COLLECT_LTO_WRAPPER=/home/gcc-releases/gcc-14-0604/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/home/gcc-releases/gcc-14-0604/ --disable-multilib --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20230604 (experimental) (GCC)
*******************************************************************************
Command Lines:
# gcc -I /home/csmith_record/include/csmith-2.3.0/  -Ofast -fno-aggressive-loop-optimizations -fno-align-functions -fno-align-jumps -fno-align-labels -fno-align-loops -fno-allocation-dce -fno-allow-store-data-races -fno-associative-math -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-cx-limited-range -fno-dce -fno-defer-pop -fno-devirtualize -fno-devirtualize-speculatively -fno-dse -fno-early-inlining -fno-expensive-optimizations -fno-finite-math-only -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-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-reciprocal-math -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-short-enums -fno-shrink-wrap -fno-shrink-wrap-separate -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-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-unsafe-math-optimizations -fno-unswitch-loops -fno-unwind-tables -fno-version-loops-for-strides -fno-aggressive-loop-optimizations -fno-align-functions -falign-jumps -falign-labels -fno-align-loops -fallocation-dce -fallow-store-data-races -fno-associative-math -fno-asynchronous-unwind-tables -fauto-inc-dec -fno-bit-tests -fno-branch-count-reg -fcaller-saves -fno-code-hoisting -fcombine-stack-adjustments -fno-compare-elim -fno-cprop-registers -fcrossjumping -fcse-follow-jumps -fno-cx-limited-range -fdce -fdefer-pop -fno-devirtualize -fdevirtualize-speculatively -fdse -fearly-inlining -fexpensive-optimizations -ffinite-math-only -fno-forward-propagate -ffp-int-builtin-inexact -fno-function-cse -fno-gcse -fgcse-after-reload -fno-gcse-lm -fno-guess-branch-probability -fno-hoist-adjacent-loads -fif-conversion -fif-conversion2 -findirect-inlining -finline -finline-atomics -fno-inline-functions -fno-inline-functions-called-once -finline-small-functions -fipa-bit-cp -fno-ipa-cp -fno-ipa-cp-clone -fno-ipa-icf -fno-ipa-icf-functions -fipa-icf-variables -fipa-modref -fipa-profile -fno-ipa-pure-const -fipa-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 -fira-share-save-slots -fira-share-spill-slots -fisolate-erroneous-paths-dereference -fno-ivopts -fno-jump-tables -flifetime-dse -fno-loop-interchange -fno-loop-unroll-and-jam -flra-remat -fmove-loop-invariants -fno-move-loop-stores -fomit-frame-pointer -fno-optimize-sibling-calls -foptimize-strlen -fpartial-inlining -fno-peel-loops -fno-peephole -fno-peephole2 -fno-plt -fno-predictive-commoning -fno-printf-return-value -fno-reciprocal-math -free -fno-reg-struct-return -freorder-blocks -fno-reorder-blocks-and-partition -freorder-functions -fno-rerun-cse-after-loop -fsched-critical-path-heuristic -fno-sched-dep-count-heuristic -fno-sched-group-heuristic -fno-sched-interblock -fsched-last-insn-heuristic -fsched-rank-heuristic -fsched-spec -fsched-spec-insn-heuristic -fno-sched-stalled-insns-dep -fno-schedule-fusion -fschedule-insns2 -fno-short-enums -fno-shrink-wrap -fno-shrink-wrap-separate -fno-split-ivs-in-unroller -fno-split-loops -fsplit-paths -fsplit-wide-types -fno-ssa-backprop -fssa-phiopt -fstdarg-opt -fstore-merging -fno-strict-aliasing -fthread-jumps -fno-toplevel-reorder -fno-tree-bit-ccp -fno-tree-builtin-call-dce -fno-tree-ccp -ftree-ch -ftree-coalesce-vars -fno-tree-copy-prop -ftree-dce -fno-tree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-distribute-patterns -fno-tree-loop-distribution -fno-tree-loop-im -fno-tree-loop-ivcanon -ftree-loop-optimize -ftree-loop-vectorize -fno-tree-partial-pre -fno-tree-phiprop -ftree-pre -fno-tree-pta -ftree-reassoc -ftree-scev-cprop -ftree-sink -fno-tree-slp-vectorize -ftree-slsr -ftree-sra -ftree-switch-conversion -fno-tree-tail-merge -ftree-ter -ftree-vrp -funroll-completely-grow-size -fno-unroll-loops -funsafe-math-optimizations -funswitch-loops -funwind-tables -fno-version-loops-for-strides ./example/code/1265.c -o ./example/code/1265.o
# ./example/code/1265.o
checksum = 9CF662D1

# /home/gcc-releases/gcc-14-0604/bin/gcc -I /home/csmith_record/include/csmith-2.3.0/  ./example/code/1265.c -o aa.o
# ./aa.o
checksum = E34942B7
Comment 1 CTC 2023-06-08 10:33:19 UTC
Created attachment 55283 [details]
The compiler output
Comment 2 Alexander Monakov 2023-06-08 11:37:40 UTC
It seems csmith was run with the --float argument. Differences under -Ofast are expected (but even without -Ofast, it seems csmith can emit bit manipulation of arbitrary floats, which can lead to unpredictable results when NaNs are involved).
Comment 3 CTC 2023-06-11 07:58:26 UTC
(In reply to Alexander Monakov from comment #2)
> It seems csmith was run with the --float argument. Differences under -Ofast
> are expected (but even without -Ofast, it seems csmith can emit bit
> manipulation of arbitrary floats, which can lead to unpredictable results
> when NaNs are involved).

It's true that I ran csmith with '--float --paranoid'. Sorry for the misreport.
Comment 4 Xi Ruoyao 2023-06-11 09:18:55 UTC
.