public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/37042]  New: Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)).
@ 2008-08-06 21:30 lennox at cs dot columbia dot edu
  2008-08-07  8:52 ` [Bug middle-end/37042] " rguenth at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: lennox at cs dot columbia dot edu @ 2008-08-06 21:30 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4919 bytes --]

The Intel SSE intrinsic function _mm_load_si128 prints a warning when the data
being loaded from is actually an array of int16_t, even though its argument
(__m128i*) is declared with __attribute__((__may_alias__)).

$ cat alias-warn-emmintrin.c
#include <emmintrin.h>
#include <stdint.h>

static const int16_t __attribute__((__aligned__(16))) tbl[8] =
{ 1, 2, 3, 4, 5, 6, 7, 8};


__m128i get_vec(void)
{
        __m128i ret;

        ret = _mm_load_si128((__m128i *)tbl);

        return ret;
}

$ ~/GCC/bin/gcc-4.3 -O2 -Wall -msse2 -c alias-warn-emmintrin.c
alias-warn-emmintrin.c: In function ‘get_vec’:
alias-warn-emmintrin.c:12: warning: likely type-punning may break
strict-aliasing rules: object ‘*{unknown}’ of main type ‘long long int
__vector__’ is referenced at or around
/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/include/emmintrin.h:681
and may be aliased to object ‘tbl’ of main type ‘short int’ which is referenced
at or around alias-warn-emmintrin.c:12.

$ ~/GCC/bin/gcc-4.3 -v -O2 -Wall -msse2 -c alias-warn-emmintrin.c
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.3-20080731/configure --enable-threads=posix
--prefix=/home/jonathan/GCC --with-local-prefix=/usr/local
--enable-languages=c,c++,objc,fortran,obj-c++,java --enable-checking=release
--enable-ssp --disable-libssp --disable-libgcj --with-system-zlib
--enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new
--disable-libstdcxx-pch --program-suffix=-4.3
--enable-version-specific-runtime-libs --without-system-libunwind
--with-cpu=generic
Thread model: posix
gcc version 4.3.2 20080731 (prerelease) (GCC)
COLLECT_GCC_OPTIONS='-v' '-O2' '-Wall' '-msse2' '-c' '-mtune=generic'
 /mnt/int_drive/jonathan/GCC/bin/../libexec/gcc/i686-pc-linux-gnu/4.3.2/cc1
-quiet -v -iprefix
/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/
alias-warn-emmintrin.c -quiet -dumpbase alias-warn-emmintrin.c -msse2
-mtune=generic -auxbase alias-warn-emmintrin -O2 -Wall -version -o
/tmp/ccKGNLjp.s
ignoring nonexistent directory
"/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../i686-pc-linux-gnu/include"
ignoring duplicate directory
"/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.3.2/include"
ignoring duplicate directory
"/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.3.2/include-fixed"
ignoring nonexistent directory
"/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/include

/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/include-fixed
 /usr/local/include
 /mnt/int_drive/jonathan/GCC/bin/../lib/gcc/../../include
 /usr/include
End of search list.
GNU C (GCC) version 4.3.2 20080731 (prerelease) (i686-pc-linux-gnu)
        compiled by GNU C version 4.3.2 20080731 (prerelease), GMP version
4.2.1, MPFR version 2.2.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 3f9a15ebf1f37358d0142d31f7849434
alias-warn-emmintrin.c: In function ‘get_vec’:
alias-warn-emmintrin.c:12: warning: likely type-punning may break
strict-aliasing rules: object ‘*{unknown}’ of main type ‘long long int
__vector__’ is referenced at or around
/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/include/emmintrin.h:681
and may be aliased to object ‘tbl’ of main type ‘short int’ which is referenced
at or around alias-warn-emmintrin.c:12.
COLLECT_GCC_OPTIONS='-v' '-O2' '-Wall' '-msse2' '-c' '-mtune=generic'
 as -V -Qy -o alias-warn-emmintrin.o /tmp/ccKGNLjp.s
GNU assembler version 2.17.50 (i586-suse-linux) using BFD version (GNU
Binutils) 2.17.50.20070726-14 (SUSE Linux)
COMPILER_PATH=/mnt/int_drive/jonathan/GCC/bin/../libexec/gcc/i686-pc-linux-gnu/4.3.2/:/mnt/int_drive/jonathan/GCC/bin/../libexec/gcc/
LIBRARY_PATH=/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/:/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/:/mnt/int_drive/jonathan/GCC/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-O2' '-Wall' '-msse2' '-c' '-mtune=generic'


-- 
           Summary: Strict-aliasing warnings are printed for _mm_load_si128,
                    even though __m128i is __attribute__((__may_alias__)).
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lennox at cs dot columbia dot edu
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/37042] Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)).
  2008-08-06 21:30 [Bug c/37042] New: Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)) lennox at cs dot columbia dot edu
@ 2008-08-07  8:52 ` rguenth at gcc dot gnu dot org
  2008-08-07  8:52 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-08-07  8:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2008-08-07 08:50 -------
Confirmed.  This is the other machinery.

typedef long long __m128i __attribute__ ((__vector_size__ (16),
__may_alias__));

extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_load_si128 (__m128i const *__P)
{
  return *__P;
}

static const short __attribute__((__aligned__(16))) tbl[8] =
{ 1, 2, 3, 4, 5, 6, 7, 8};


__m128i get_vec(void)
{
  __m128i ret;

  ret = _mm_load_si128((__m128i *)tbl);

  return ret;
}


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2008-08-07 08:50:50
               date|                            |


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/37042] Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)).
  2008-08-06 21:30 [Bug c/37042] New: Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)) lennox at cs dot columbia dot edu
  2008-08-07  8:52 ` [Bug middle-end/37042] " rguenth at gcc dot gnu dot org
@ 2008-08-07  8:52 ` rguenth at gcc dot gnu dot org
  2008-08-07 10:02 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-08-07  8:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-08-07 08:51 -------
Mine.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-08-07 08:50:50         |2008-08-07 08:51:06
               date|                            |


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/37042] Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)).
  2008-08-06 21:30 [Bug c/37042] New: Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)) lennox at cs dot columbia dot edu
  2008-08-07  8:52 ` [Bug middle-end/37042] " rguenth at gcc dot gnu dot org
  2008-08-07  8:52 ` rguenth at gcc dot gnu dot org
@ 2008-08-07 10:02 ` rguenth at gcc dot gnu dot org
  2008-08-07 10:03 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-08-07 10:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2008-08-07 10:01 -------
Subject: Bug 37042

Author: rguenth
Date: Thu Aug  7 09:59:58 2008
New Revision: 138836

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138836
Log:
2008-08-07  Richard Guenther  <rguenther@suse.de>

        PR middle-end/37042
        * tree-ssa-alias-warnings.c (nonstandard_alias_p): Ref-all
        pointers can access anything.

        * gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c: New testcase.

Added:
   
branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_3-branch/gcc/tree-ssa-alias-warnings.c


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/37042] Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)).
  2008-08-06 21:30 [Bug c/37042] New: Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)) lennox at cs dot columbia dot edu
                   ` (2 preceding siblings ...)
  2008-08-07 10:02 ` rguenth at gcc dot gnu dot org
@ 2008-08-07 10:03 ` rguenth at gcc dot gnu dot org
  2008-08-07 10:04 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-08-07 10:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2008-08-07 10:02 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.2


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/37042] Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)).
  2008-08-06 21:30 [Bug c/37042] New: Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)) lennox at cs dot columbia dot edu
                   ` (3 preceding siblings ...)
  2008-08-07 10:03 ` rguenth at gcc dot gnu dot org
@ 2008-08-07 10:04 ` rguenth at gcc dot gnu dot org
  2008-08-10 20:20 ` pinskia at gcc dot gnu dot org
  2008-08-11 14:12 ` lennox at cs dot columbia dot edu
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-08-07 10:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2008-08-07 10:03 -------
Subject: Bug 37042

Author: rguenth
Date: Thu Aug  7 10:01:48 2008
New Revision: 138837

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138837
Log:
2008-08-07  Richard Guenther  <rguenther@suse.de>

        PR middle-end/37042
        * tree-ssa-alias-warnings.c (nonstandard_alias_p): Ref-all
        pointers can access anything.

        * gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-alias-warnings.c


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/37042] Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)).
  2008-08-06 21:30 [Bug c/37042] New: Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)) lennox at cs dot columbia dot edu
                   ` (4 preceding siblings ...)
  2008-08-07 10:04 ` rguenth at gcc dot gnu dot org
@ 2008-08-10 20:20 ` pinskia at gcc dot gnu dot org
  2008-08-11 14:12 ` lennox at cs dot columbia dot edu
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-08-10 20:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2008-08-10 20:19 -------
Note this testcase fails on powerpc64-linux-gnu with the following warning:
/home/apinski/src/local/gcc/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c:8:
warning: GCC vector returned by reference: non-standard ABI extension
with no compatibility guarantee


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/37042] Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)).
  2008-08-06 21:30 [Bug c/37042] New: Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)) lennox at cs dot columbia dot edu
                   ` (5 preceding siblings ...)
  2008-08-10 20:20 ` pinskia at gcc dot gnu dot org
@ 2008-08-11 14:12 ` lennox at cs dot columbia dot edu
  6 siblings, 0 replies; 8+ messages in thread
From: lennox at cs dot columbia dot edu @ 2008-08-11 14:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from lennox at cs dot columbia dot edu  2008-08-11 14:11 -------
The fact that the function returns the vector is not an essential part of the
test; the return value of the load function just needs not to be optimized out
as unused.  So changing the test for broader compatibility is fine as far as
I'm concerned.


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-08-11 14:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-06 21:30 [Bug c/37042] New: Strict-aliasing warnings are printed for _mm_load_si128, even though __m128i is __attribute__((__may_alias__)) lennox at cs dot columbia dot edu
2008-08-07  8:52 ` [Bug middle-end/37042] " rguenth at gcc dot gnu dot org
2008-08-07  8:52 ` rguenth at gcc dot gnu dot org
2008-08-07 10:02 ` rguenth at gcc dot gnu dot org
2008-08-07 10:03 ` rguenth at gcc dot gnu dot org
2008-08-07 10:04 ` rguenth at gcc dot gnu dot org
2008-08-10 20:20 ` pinskia at gcc dot gnu dot org
2008-08-11 14:12 ` lennox at cs dot columbia dot edu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).