https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67739
Bug ID: 67739
Summary: name clash between builtin functions and local
variables when optimization is on
Product: gcc
Version: 4.9.3
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: milan.durovic at ali dot com.au
Target Milestone: ---
Created attachment 36404
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36404&action=edit
simple test program illustrating the problem with gcc 4.8.1
This bug also appears in 4.8.1 version.
We have a local static array called 'sincos'. The code is calculating sin() and
cos() of the same value.
Compiler generates a call to 'sincos' method. However, the address of 'sincos'
method is resolved to be the address of the local static variable of the same
name, leading to an error. Compiler hasn't generated ANY warnings about this
name clash.
Identical problem exists in 4.8.1 compiler, except that here the function name
is 'sincosf'. It seems like this is a long standing error.
Compiler invocation:
gcc -O1 -lm test.c -Wall -Wextra -save-temps
Then:
./a.out
does segmentation fault.