Bug 476370 - floor_log2 and exact_log2 redef in gcc
Summary: floor_log2 and exact_log2 redef in gcc
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 10
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-12-13 18:41 UTC by Brennan Ashton
Modified: 2009-02-12 10:21 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-02-12 10:21:13 UTC
Type: ---


Attachments (Terms of Use)

Description Brennan Ashton 2008-12-13 18:41:39 UTC
Description of problem:
When compiling cross compilers with gcc 4 I get redefinition errors for 
floor_log2 and exact_log2
I am working on the m6812-elf cross compiler but I am using the avr-gcc one in this report, as it is part of fedora and there is a srpm that was known to work.


Version-Release number of selected component (if applicable):
gcc (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7)

How reproducible:
every time

Steps to Reproduce:
1. compile the srpm for avr-gcc

  
Actual results:

gcc -std=gnu99 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-p
rotector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronou
s-unwind-tables   -g -O2  -DIN_GCC -DCROSS_COMPILE  -W -Wall -Wwrite-strings -Ws
trict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-mac
ros -Wold-style-definition -Wmissing-format-attribute    -DHAVE_CONFIG_H -I. -I.
 -I../../gcc-4.1.2/gcc -I../../gcc-4.1.2/gcc/. -I../../gcc-4.1.2/gcc/../include 
-I../../gcc-4.1.2/gcc/../libcpp/include     \
          -DTARGET_NAME=\"avr\" \
          -c ../../gcc-4.1.2/gcc/toplev.c -o toplev.o
../../gcc-4.1.2/gcc/toplev.c:524: error: redefinition of 'floor_log2'
../../gcc-4.1.2/gcc/toplev.h:176: error: previous definition of 'floor_log2' was
 here
../../gcc-4.1.2/gcc/toplev.c:559: error: redefinition of 'exact_log2'
../../gcc-4.1.2/gcc/toplev.h:182: error: previous definition of 'exact_log2' was
 here
../../gcc-4.1.2/gcc/toplev.c: In function 'pch_option_mismatch':
../../gcc-4.1.2/gcc/toplev.c:1331: warning: ignoring return value of 'asprintf',
 declared with attribute warn_unused_result

Expected results:
Compile

Additional info:

It looks like this would work if I passed -std=gnu90

Comment 1 Jakub Jelinek 2008-12-14 20:51:34 UTC
You need to use -fgnu89-inline then, the default in gcc 4.3 and later is -fno-gnu89-inline, i.e. ISO C99 semantics of extern inline.
GCC 4.1.2 in toplev.h assumed that when GCC >= 3.0 was used as bootstrap compiler, it would have the GNU extern inline semantics.

Comment 2 Brennan Ashton 2008-12-18 05:33:38 UTC
That did not fix it, I also get this on 4.3.2 which is what I am using.

gcc -std=gnu99 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -fno-gnu89-inline   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros 				     -Wno-overlength-strings    -DHAVE_CONFIG_H -I. -I. -I../../gcc-4.3.2/gcc -I../../gcc-4.3.2/gcc/. -I../../gcc-4.3.2/gcc/../include -I../../gcc-4.3.2/gcc/../libcpp/include  -I../../gcc-4.3.2/gcc/../libdecnumber -I../../gcc-4.3.2/gcc/../libdecnumber/dpd -I../libdecnumber   -DUSE_GAS \
	  -DTARGET_NAME=\"m6812-elf\" \
	  -c ../../gcc-4.3.2/gcc/toplev.c -o toplev.o
../../gcc-4.3.2/gcc/toplev.c:545: error: redefinition of 'floor_log2'
../../gcc-4.3.2/gcc/toplev.h:178: error: previous definition of 'floor_log2' was here
../../gcc-4.3.2/gcc/toplev.c:580: error: redefinition of 'exact_log2'
../../gcc-4.3.2/gcc/toplev.h:184: error: previous definition of 'exact_log2' was here
../../gcc-4.3.2/gcc/toplev.c: In function 'pch_option_mismatch':
../../gcc-4.3.2/gcc/toplev.c:1511: warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result
make[2]: *** [toplev.o] Error 1
make[2]: Leaving directory `/home/makerpm/rpmbuild/BUILD/m6812-elf-gcc-4.3.2/gcc-m6812-elf/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/home/makerpm/rpmbuild/BUILD/m6812-elf-gcc-4.3.2/gcc-m6812-elf'
make: *** [all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.fu8pFI (%build)

Comment 3 Jakub Jelinek 2009-02-12 10:21:13 UTC
You are using -fno-gnu89-inline, not -fgnu89-inline as I told you to.


Note You need to log in before you can comment on or make changes to this bug.