[Bug c++/56665] New: -O2 with -fno-strict-aliasing makes boost::spirit::classic::assign_a not working

bodzio131 at op dot pl gcc-bugzilla@gcc.gnu.org
Wed Mar 20 11:49:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56665

             Bug #: 56665
           Summary: -O2 with -fno-strict-aliasing makes
                    boost::spirit::classic::assign_a not working
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bodzio131@op.pl


Hi,

I have problem using gcc4.7.2 with -fno-strict-aliasing switch along with -O2.
This combination makes boost::spirit::classic::assign_a (boost1.48) not working
properly. In undermentioned example value 101101 is not assigned to 'variable'.
It worked fine with gcc3.4.3, and it works ok with gcc4.7.2 -O2 without
-fno-strict-aliasing.

//---------- start ------------
#include <boost/spirit/include/classic.hpp>
#include <boost/spirit/include/phoenix1.hpp>

#include <stdio.h>

int main()
{
    int variable = 123;

    using namespace boost::spirit::classic;
    using namespace phoenix;

    rule<> testRule
        // =  eps_p [ var( variable ) = 101101 ] //that one works fine with -O2
-fno-strict-aliasing
        =  eps_p [ assign_a( variable, 101101 ) ] //this one gives rubbish with
-O2 -fno-strict-aliasing
        ;    

    parse_info<> result = parse( "bla bla", testRule );

    if ( result.hit )
        printf( "%d\n", variable );

    return 0;
}
//---------- end ------------

gcc details:
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/build/storage/toolchain/gcc-4.7.2/bin/../libexec/gcc/i686-pc-linux-gnu/4.7.2/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.7.2/configure --prefix=/usr/local/gcc-4.7.2
--enable-languages=c,c++ --with-gmp=/usr/local/gcc-4.7.2
--with-ppl=/usr/local/gcc-4.7.2 --with-cloog=/usr/local/gcc-4.7.2
Thread model: posix
gcc version 4.7.2 (GCC) 

Whole comilation log (g++ -v -save-temps -O2 -fno-strict-aliasing -pthread
-I/usr/local/gcc-4.7.2/STLport-5.2.1/boost-1.48/include
-L/usr/local/gcc-4.7.2/STLport-5.2.1/lib main.cpp -o test):

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/build/storage/toolchain/gcc-4.7.2/bin/../libexec/gcc/i686-pc-linux-gnu/4.7.2/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.7.2/configure --prefix=/usr/local/gcc-4.7.2
--enable-languages=c,c++ --with-gmp=/usr/local/gcc-4.7.2
--with-ppl=/usr/local/gcc-4.7.2 --with-cloog=/usr/local/gcc-4.7.2
Thread model: posix
gcc version 4.7.2 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-fno-strict-aliasing' '-pthread'
'-I' '/usr/local/gcc-4.7.2/STLport-5.2.1/boost-1.48/include'
'-L/usr/local/gcc-4.7.2/STLport-5.2.1/lib' '-o' 'test' '-shared-libgcc'
'-mtune=generic' '-march=pentiumpro'

/home/build/storage/toolchain/gcc-4.7.2/bin/../libexec/gcc/i686-pc-linux-gnu/4.7.2/cc1plus
-E -quiet -v -I /usr/local/gcc-4.7.2/STLport-5.2.1/boost-1.48/include -iprefix
/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/
-D_GNU_SOURCE -D_REENTRANT main.cpp -mtune=generic -march=pentiumpro
-fno-strict-aliasing -O2 -fpch-preprocess -o main.ii
ignoring nonexistent directory
"/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../i686-pc-linux-gnu/include"
ignoring duplicate directory
"/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2"
ignoring duplicate directory
"/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/i686-pc-linux-gnu"
ignoring duplicate directory
"/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/backward"
ignoring duplicate directory
"/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.7.2/include"
ignoring duplicate directory
"/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.7.2/include-fixed"
ignoring nonexistent directory
"/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/gcc-4.7.2/STLport-5.2.1/boost-1.48/include

/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2

/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/i686-pc-linux-gnu

/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/backward

/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/include

/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/include-fixed
 /usr/local/include
 /home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/../../include
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-fno-strict-aliasing' '-pthread'
'-I' '/usr/local/gcc-4.7.2/STLport-5.2.1/boost-1.48/include'
'-L/usr/local/gcc-4.7.2/STLport-5.2.1/lib' '-o' 'test' '-shared-libgcc'
'-mtune=generic' '-march=pentiumpro'

/home/build/storage/toolchain/gcc-4.7.2/bin/../libexec/gcc/i686-pc-linux-gnu/4.7.2/cc1plus
-fpreprocessed main.ii -quiet -dumpbase main.cpp -mtune=generic
-march=pentiumpro -auxbase main -O2 -version -fno-strict-aliasing -o main.s
GNU C++ (GCC) version 4.7.2 (i686-pc-linux-gnu)
    compiled by GNU C version 4.7.2, GMP version 4.3.2, MPFR version 2.4.2, MPC
version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 4.7.2 (i686-pc-linux-gnu)
    compiled by GNU C version 4.7.2, GMP version 4.3.2, MPFR version 2.4.2, MPC
version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 18f6eb2e590887d903a9b1835552c140
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-fno-strict-aliasing' '-pthread'
'-I' '/usr/local/gcc-4.7.2/STLport-5.2.1/boost-1.48/include'
'-L/usr/local/gcc-4.7.2/STLport-5.2.1/lib' '-o' 'test' '-shared-libgcc'
'-mtune=generic' '-march=pentiumpro'

/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../i686-pc-linux-gnu/bin/as
-v -I /usr/local/gcc-4.7.2/STLport-5.2.1/boost-1.48/include --32 -o main.o
main.s
GNU assembler version 2.21.1 (i686-pc-linux-gnu) using BFD version (GNU
Binutils) 2.21.1
COMPILER_PATH=/home/build/storage/toolchain/gcc-4.7.2/bin/../libexec/gcc/i686-pc-linux-gnu/4.7.2/:/home/build/storage/toolchain/gcc-4.7.2/bin/../libexec/gcc/:/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../i686-pc-linux-gnu/bin/
LIBRARY_PATH=/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/:/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/:/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../i686-pc-linux-gnu/lib/:/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-fno-strict-aliasing' '-pthread'
'-I' '/usr/local/gcc-4.7.2/STLport-5.2.1/boost-1.48/include'
'-L/usr/local/gcc-4.7.2/STLport-5.2.1/lib' '-o' 'test' '-shared-libgcc'
'-mtune=generic' '-march=pentiumpro'

/home/build/storage/toolchain/gcc-4.7.2/bin/../libexec/gcc/i686-pc-linux-gnu/4.7.2/collect2
--eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o test
/usr/lib/crt1.o /usr/lib/crti.o
/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/crtbegin.o
-L/usr/local/gcc-4.7.2/STLport-5.2.1/lib
-L/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2
-L/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc
-L/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../i686-pc-linux-gnu/lib
-L/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/../../..
main.o -lstdc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc
/home/build/storage/toolchain/gcc-4.7.2/bin/../lib/gcc/i686-pc-linux-gnu/4.7.2/crtend.o
/usr/lib/crtn.o



More information about the Gcc-bugs mailing list