c++/1622: -fvtable-gc flag optimizes away virtual functions even if function is used
alex@selresearch.net
alex@selresearch.net
Thu Jan 11 14:06:00 GMT 2001
>Number: 1622
>Category: c++
>Synopsis: -fvtable-gc flag optimizes away virtual functions even if function is used
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jan 11 14:06:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: alex@selresearch.net
>Release: gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
windows 2000. i686
cross compiled for arm-elf target.
eCos gcc patch applied
file is linked with eCos from cvs source three.
file is executed on intel Assabet board.
I expect this bug can be reproduced on other platforms as well.
>Description:
Makefile output with options:
-----------------------------------------------
arm-elf-gcc -mcpu=strongarm -c -o cpptest.o -g -v -save-temps -Wall -I//c/My\ Documents/Public/eCos/test_install/include -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti -fvtable-gc -finit-priority cpptest.cxx
Reading specs from /tools/H-i686-pc-cygwin/lib/gcc-lib/arm-elf/2.95.2/specs
gcc version 2.95.2 19991024 (release)
/tools/H-i686-pc-cygwin/lib/gcc-lib/arm-elf/2.95.2/cpp.exe -lang-c++ -v -I//c/My Documents/Public/eCos/test_install/include -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Darm -Darm_elf -D__ELF__ -D__arm__ -D__arm_elf__ -D__ELF__ -D__arm -D__arm_elf -Acpu(arm) -Amachine(arm) -D__CHAR_UNSIGNED__ -g -Wall -D__ARM_ARCH_4__ -D__APCS_32__ cpptest.cxx cpptest.ii
GNU CPP version 2.95.2 19991024 (release) (ARM/ELF non-Linux)
#include "..." search starts here:
#include <...> search starts here:
//c/My Documents/Public/eCos/test_install/include
/tools/H-i686-pc-cygwin/lib/gcc-lib/arm-elf/2.95.2/include
/tools/H-i686-pc-cygwin/lib/gcc-lib/arm-elf/2.95.2/../../../../arm-elf/include
End of search list.
The following default directories have been omitted from the search path:
/tools/H-i686-pc-cygwin/lib/gcc-lib/arm-elf/2.95.2/../../../../../include/g++-3
/tools/H-i686-pc-cygwin/lib/gcc-lib/arm-elf/2.95.2/../../../../arm-elf/sys-include
End of omitted list.
/tools/H-i686-pc-cygwin/lib/gcc-lib/arm-elf/2.95.2/cc1plus.exe cpptest.ii -quiet -dumpbase cpptest.cc -mcpu=strongarm -g -Wall -version -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti -fvtable-gc -finit-priority -o cpptest.s
GNU C++ version 2.95.2 19991024 (release) (arm-elf) compiled by GNU C version 2.95.2 19991024 (release-2).
/tools/H-i686-pc-cygwin/arm-elf/bin/as.exe -mstrongarm -o cpptest.o cpptest.s
arm-elf-gcc -mcpu=strongarm -nostartfiles -L//c/My\ Documents/Public/eCos/test_install/lib -Wl,--gc-sections -o cpptest cpptest.o -Ttarget.ld -nostdlib
-----------------------------------------------------------
options passed to configure when gcc was built:
-----------------------------------------------------------
/src/gcc/gcc-2.95.2/configure --target=arm-elf \
--prefix=/tools \
--exec-prefix=/tools/H-i686-pc-cygwin \
--with-gnu-as --with-gnu-ld --with-newlib \
-v 2>&1 | tee configure.out
-----------------------------------------------------------
Description of the problem:
Virtual fuction Test2::f1() is removed from executable if option -fvtable-gc is used. Entry for this function in virtual table is 0 resulting exception being generated on execution. If -fvtable-gc falg is not used executable is correct.
Sample preprocessed file is attached.
>How-To-Repeat:
Compile attached file.
Run it.
Exception is generated.
>Fix:
1)do not use -fvtable-gc option
2)there only two places in gcc where this option is chenked.
these places can be conditionally turned off for arm architecture to generate correct code.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list