[Bug c/52544] New: compilation fails with -finstrument-functions and sse c code

jgpiccinali at free dot fr gcc-bugzilla@gcc.gnu.org
Fri Mar 9 17:30:00 GMT 2012


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

             Bug #: 52544
           Summary: compilation fails with -finstrument-functions and sse
                    c code
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jgpiccinali@free.fr


Created attachment 26866
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26866
the src code that reproduce the issue.

Hi,

I'd like to report an issue with gcc versions >= 4.6.x :
when compiling my sse.c code with "gcc -Wall -Wextra -fno-strict-aliasing
-fwrapv sse.c", 
all versions of gcc (434, 453, 462, 463, 47 and 480) create a correct
executable, 
that will give the correct output at runtime : 

    * x = [1.250000 1.250000 1.250000 1.250000]

BUT 

if i add "-finstrument-functions" to the compilation line, 
then only version < 4.6.x (versions 434 and 453 in my tests) will compile my
code, 
otherwise (= gcc versions 462, 463, 47 and 480), compilation will stop with the
following message :

    * /tmp/cckYj6ai.o: In function `main':
    * sse.c:(.text+0x2a): undefined reference to `_mm_set1_ps'
    * sse.c:(.text+0x50): undefined reference to `_mm_set1_ps'
    * sse.c:(.text+0x79): undefined reference to `_mm_store_ps'
    * sse.c:(.text+0x95): undefined reference to `_mm_store_ps'
    * collect2: ld returned 1 exit status

gcc was compiled with :
        configure \
                  --enable-languages=c \
                  --enable-threads=posix \
                  --enable-shared \
                  --with-mpfr=/apps/rothorn/mpfr/3.0.0/gcc-4.3.4 \
                  --with-gmp=/apps/rothorn/gmp/4.3.2/gcc-4.3.4 \
                  --with-mpc=/apps/rothorn/mpc/0.8.2/gcc-4.3.4

gcc/4.7   was compiled with revision 184577 of the svn.
gcc/4.8.0 was compiled with revision 185132 of the svn.
Tested on GNU/Linux with Intel (Ubuntu/11.04) and AMD (SLES/11.1) cpus.

What's wrong please ?

Thanks in advance for your help.

The original src is sse.c :
#include <stdio.h>
#include <xmmintrin.h>

int main(void)
{
        float xf[4];
        __m128 x = _mm_set1_ps(1.25f);
        _mm_store_ps(&xf[0], x);
        printf("x = [%f %f %f %f]\n", xf[0], xf[1], xf[2], xf[3]);
        return 0;
}

The preprocessed src (with gcc version 4.6.3) is attached, and the full output
is here :


rothorn:/apps/rothorn/sandbox/jgp/gcc/bugA $ ./463 -v -save-temps -Wall -Wextra
-fno-strict-aliasing -fwrapv sse.c -finstrument-functions 

Using built-in specs.
COLLECT_GCC=./463
COLLECT_LTO_WRAPPER=/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /apps/rothorn/sandbox/jgp/gcc/src/gcc-4.6.3/configure
--prefix=/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434 --enable-languages=c
--enable-threads=posix --enable-shared
--with-mpfr=/apps/rothorn/mpfr/3.0.0/gcc-4.3.4
--with-gmp=/apps/rothorn/gmp/4.3.2/gcc-4.3.4
--with-mpc=/apps/rothorn/mpc/0.8.2/gcc-4.3.4
Thread model: posix
gcc version 4.6.3 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-fno-strict-aliasing'
'-fwrapv' '-finstrument-functions' '-mtune=generic' '-march=x86-64'

/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3/cc1
-E -quiet -v sse.c -mtune=generic -march=x86-64 -Wall -Wextra
-fno-strict-aliasing -fwrapv -finstrument-functions -fpch-preprocess -o sse.i
ignoring nonexistent directory
"/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/include
 /usr/local/include
 /apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/include

/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-fno-strict-aliasing'
'-fwrapv' '-finstrument-functions' '-mtune=generic' '-march=x86-64'

/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3/cc1
-fpreprocessed sse.i -quiet -dumpbase sse.c -mtune=generic -march=x86-64
-auxbase sse -Wall -Wextra -version -fno-strict-aliasing -fwrapv
-finstrument-functions -o sse.s
GNU C (GCC) version 4.6.3 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.6.3, GMP version 4.3.2, MPFR version 3.0.0, MPC
version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C (GCC) version 4.6.3 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.6.3, GMP version 4.3.2, MPFR version 3.0.0, MPC
version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 221f59dff4d036c76c9a0dfc4c602ad0
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-fno-strict-aliasing'
'-fwrapv' '-finstrument-functions' '-mtune=generic' '-march=x86-64'
 as --64 -o sse.o sse.s
COMPILER_PATH=/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3/:/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3/:/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/libexec/gcc/x86_64-unknown-linux-gnu/:/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/:/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/lib/gcc/x86_64-unknown-linux-gnu/
LIBRARY_PATH=/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/:/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-fno-strict-aliasing'
'-fwrapv' '-finstrument-functions' '-mtune=generic' '-march=x86-64'

/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3/collect2
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2
/usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o
/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/crtbegin.o
-L/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/lib/gcc/x86_64-unknown-linux-gnu/4.6.3
-L/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../..
sse.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s
--no-as-needed
/apps/rothorn/sandbox/jgp/gcc/4.6.3/gnu434/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/crtend.o
/usr/lib/../lib64/crtn.o
sse.o: In function `main':
sse.c:(.text+0x2a): undefined reference to `_mm_set1_ps'
sse.c:(.text+0x50): undefined reference to `_mm_set1_ps'
sse.c:(.text+0x79): undefined reference to `_mm_store_ps'
sse.c:(.text+0x95): undefined reference to `_mm_store_ps'
collect2: ld returned 1 exit status



More information about the Gcc-bugs mailing list