[Bug c/97980] New: wrong code with "-O3 -fno-dce -fno-inline-functions-called-once -fno-inline-small-functions -fno-tree-ccp -fno-tree-dce -fno-tree-vrp"
suochenyao at 163 dot com
gcc-bugzilla@gcc.gnu.org
Wed Nov 25 07:46:28 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97980
Bug ID: 97980
Summary: wrong code with "-O3 -fno-dce
-fno-inline-functions-called-once
-fno-inline-small-functions -fno-tree-ccp
-fno-tree-dce -fno-tree-vrp"
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: suochenyao at 163 dot com
Target Milestone: ---
*******************************************************************************
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
*******************************************************************************
Program:
int a=2;
static int b(int *c) { (0 >= *c) & (a--); return 0; }
int main() {
int d=0;
b(&d);
}
*******************************************************************************
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/home/suocy/bin/gcc-dev/bin/gcc
COLLECT_LTO_WRAPPER=/home/suocy/bin/gcc-dev/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/suocy/bin/gcc-dev/
--disable-multilib --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201124 (experimental) (GCC)
*******************************************************************************
Command Lines:
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -O3 -fno-dce
-fno-inline-functions-called-once -fno-inline-small-functions -fno-tree-ccp
-fno-tree-dce -fno-tree-vrp a.c
a.c: In function ‘b’:
a.c:2:34: warning: value computed is not used [-Wunused-value]
2 | static int b(int *c) { (0 >= *c) & (a--); return 0; }
| ~~~~~~~~~~^~~~~~~
a.c: In function ‘b.constprop.isra’:
a.c:2:30: warning: ‘c’ is used uninitialized [-Wuninitialized]
2 | static int b(int *c) { (0 >= *c) & (a--); return 0; }
| ^~
$ ./a.out
Segmentation fault
More information about the Gcc-bugs
mailing list