This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/28887] New: generates invalid code for -O1 -fprefetch-loop-arrays
- From: "aldot at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Aug 2006 12:43:18 -0000
- Subject: [Bug c/28887] New: generates invalid code for -O1 -fprefetch-loop-arrays
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Alleged bug goes away if ommitting -fprefetch-loop-arrays.
Trying to compile binutils-2.17.50.0.3 (gdb-6.4 also exhibits this alleged bug)
with gcc-trunk from 20060828, i get errors of the form:
make[3]: Entering directory
`/root/src/buildroot/build_x86_64/binutils-2.17.50.0.3-target/libiberty'
if [ x"" != x ] && [ ! -d pic ]; then \
mkdir pic; \
else true; fi
touch stamp-picdir
if [ x"" != x ]; then \
x86_64-linux-uclibc-gcc -c -DHAVE_CONFIG_H -O2 -fPIC
-ftree-loop-optimize -ftree-vectorize -ftree-vect-loop-version -funroll-loops
-freorder-blocks -freorder-blocks-and-partition -mtune=nocona -march=nocona
-msse -msse2 -msse3 -mfpmath=sse -fprefetch-loop-arrays -funswitch-loops
-fbranch-target-load-optimize -ftree-loop-linear -ftree-loop-im
-ftree-loop-ivcanon -fgcse-after-reload -fvariable-expansion-in-unroller
-fivopts -I.
-I/root/src/buildroot/toolchain_build_x86_64/binutils-2.17.50.0.3/libiberty/../include
-W -Wall -pedantic -Wwrite-strings -Wstrict-prototypes -Wc++-compat
/root/src/buildroot/toolchain_build_x86_64/binutils-2.17.50.0.3/libiberty/regex.c
-o pic/regex.o; \
else true; fi
x86_64-linux-uclibc-gcc -c -DHAVE_CONFIG_H -O2 -fPIC -ftree-loop-optimize
-ftree-vectorize -ftree-vect-loop-version -funroll-loops -freorder-blocks
-freorder-blocks-and-partition -mtune=nocona -march=nocona -msse -msse2 -msse3
-mfpmath=sse -fprefetch-loop-arrays -funswitch-loops
-fbranch-target-load-optimize -ftree-loop-linear -ftree-loop-im
-ftree-loop-ivcanon -fgcse-after-reload -fvariable-expansion-in-unroller
-fivopts -I.
-I/root/src/buildroot/toolchain_build_x86_64/binutils-2.17.50.0.3/libiberty/../include
-W -Wall -pedantic -Wwrite-strings -Wstrict-prototypes -Wc++-compat
/root/src/buildroot/toolchain_build_x86_64/binutils-2.17.50.0.3/libiberty/regex.c
-o regex.o
/root/src/buildroot/toolchain_build_x86_64/binutils-2.17.50.0.3/libiberty/regex.c:
In function 'byte_re_match_2_internal':
/root/src/buildroot/toolchain_build_x86_64/binutils-2.17.50.0.3/libiberty/regex.c:5549:
error: cannot take address of bit-field 'match_null_string_p'
/root/src/buildroot/toolchain_build_x86_64/binutils-2.17.50.0.3/libiberty/regex.c:5549:
error: cannot take address of bit-field 'match_null_string_p'
/root/src/buildroot/toolchain_build_x86_64/binutils-2.17.50.0.3/libiberty/regex.c:5549:
error: cannot take address of bit-field 'match_null_string_p'
make[3]: *** [regex.o] Error 1
make[3]: Leaving directory
`/root/src/buildroot/build_x86_64/binutils-2.17.50.0.3-target/libiberty'
make[2]: *** [all-libiberty] Error 2
make[2]: Leaving directory
`/root/src/buildroot/build_x86_64/binutils-2.17.50.0.3-target'
make[1]: *** [all] Error 2
make[1]: Leaving directory
`/root/src/buildroot/build_x86_64/binutils-2.17.50.0.3-target'
make: ***
[/root/src/buildroot/build_x86_64/binutils-2.17.50.0.3-target/binutils/objdump]
Error 2
Reduced testcase:
# cat c.i
typedef long unsigned int size_t;
struct re_pattern_buffer
{
size_t re_nsub;
};
typedef enum
{
start_memory,
} re_opcode_t;
typedef union
{
struct
{
unsigned matched_something:1;
} bits;
} byte_register_info_type;
byte_re_match_2_internal (struct re_pattern_buffer *bufp)
{
int mcnt;
size_t num_regs = bufp->re_nsub + 1;
byte_register_info_type *reg_info;
for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
{
((reg_info[mcnt]).bits.matched_something) = 0;
}
}
x86_64-linux-uclibc-gcc -O1 -fprefetch-loop-arrays c.i -c -o regex.o -v
Using built-in specs.
Target: x86_64-linux-uclibc
Configured with: /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/configure
--prefix=/root/src/buildroot/build_x86_64/staging_dir
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-linux-uclibc --enable-languages=c,c++ --enable-shared
--disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls
--enable-threads --disable-multilib
Thread model: posix
gcc version 4.2.0 20060828 (experimental)
/root/src/buildroot/build_x86_64/staging_dir/libexec/gcc/x86_64-linux-uclibc/4.2.0/cc1
-fpreprocessed c.i -quiet -dumpbase c.i -mtune=generic -auxbase-strip regex.o
-O1 -version -fprefetch-loop-arrays -o /tmp/ccwSTKtj.s
GNU C version 4.2.0 20060828 (experimental) (x86_64-linux-uclibc)
compiled by GNU C version 4.1.2 20060613 (prerelease) (Debian 4.1.1-5).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 7dbca204c110dec99203ab2b693d4e2f
c.i: In function 'byte_re_match_2_internal':
c.i:18: error: cannot take address of bit-field 'matched_something'
c.i:18: error: cannot take address of bit-field 'matched_something'
c.i:18: error: cannot take address of bit-field 'matched_something'
--
Summary: generates invalid code for -O1 -fprefetch-loop-arrays
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: aldot at gcc dot gnu dot org
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28887