[Bug target/115409] avx512 intrinsics trigger -Wshift-overflow

2024-06-23 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115409

Sam James  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED
   Target Milestone|--- |15.0

--- Comment #6 from Sam James  ---
Fixed then.

[Bug target/115409] avx512 intrinsics trigger -Wshift-overflow

2024-06-22 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115409

--- Comment #5 from GCC Commits  ---
The master branch has been updated by hongtao Liu :

https://gcc.gnu.org/g:4c957d7ba84d8bbce6e778048f38e92ef71806c8

commit r15-1563-g4c957d7ba84d8bbce6e778048f38e92ef71806c8
Author: Collin Funk 
Date:   Mon Jun 10 06:36:47 2024 +

AVX-512: Pacify -Wshift-overflow=2. [PR115409]

A shift of 31 on a signed int is undefined behavior.  Since unsigned
int is 32-bits wide this change fixes it and silences the warning.

gcc/ChangeLog:

PR target/115409
* config/i386/avx512fp16intrin.h (_mm512_conj_pch): Make the
constant unsigned before shifting.
* config/i386/avx512fp16vlintrin.h (_mm256_conj_pch): Likewise.
(_mm_conj_pch): Likewise.

Signed-off-by: Collin Funk 

[Bug target/115409] avx512 intrinsics trigger -Wshift-overflow

2024-06-10 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115409

Eric Gallager  changed:

   What|Removed |Added

URL||https://gcc.gnu.org/piperma
   ||il/gcc-patches/2024-June/65
   ||4016.html
 CC||egallager at gcc dot gnu.org
   Keywords||patch

--- Comment #4 from Eric Gallager  ---
(In reply to Collin Funk from comment #3)
> I'll read the page you sent and send a patch to gcc-patches referencing this
> bug report.

Linking the sent patch:
https://gcc.gnu.org/pipermail/gcc-patches/2024-June/654016.html

[Bug target/115409] avx512 intrinsics trigger -Wshift-overflow

2024-06-09 Thread collin.funk1 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115409

--- Comment #3 from Collin Funk  ---
Oops, Sorry about that. Here is the compile command:

gcc15.0  -I. -I./lib  -Ilib -I./lib -Isrc -I./src   -fstrict-flex-arrays -Wall
-Warith-conversion -Wbad-function-cast -Wcast-align=strict -Wdate-time
-Wdisabled-optimization -Wduplicated-cond -Wextra -Wformat-signedness
-Wflex-array-member-not-at-end -Winit-self -Winvalid-pch -Wlogical-op
-Wmissing-declarations -Wmissing-include-dirs -Wnull-dereference -Wopenmp-simd
-Woverlength-strings -Wpacked -Wpointer-arith -Wshadow -Wstrict-flex-arrays
-Wstrict-prototypes -Wsuggest-attribute=cold -Wsuggest-attribute=const
-Wsuggest-attribute=format -Wsuggest-attribute=malloc
-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsuggest-final-methods
-Wsuggest-final-types -Wsync-nand -Wtrampolines -Wunknown-pragmas
-Wvariadic-macros -Wvla -Wwrite-strings -Warray-bounds=2 -Wattribute-alias=2
-Wbidi-chars=any,ucn -Wformat=2 -Wimplicit-fallthrough=5 -Wshift-overflow=2
-Wuse-after-free=3 -Wunused-const-variable=2 -Wvla-larger-than=4031
-Wno-sign-compare -Wno-unused-parameter -Wno-format-nonliteral
-fdiagnostics-show-option -funit-at-a-time -Wno-return-local-addr
-Wno-stringop-overflow -Wno-cast-qual -Wno-conversion -Wno-float-equal
-Wno-sign-compare -Wno-undef -Wno-unused-function -Wno-unused-parameter
-Wno-float-conversion -Wimplicit-fallthrough -Wno-pedantic -Wno-sign-conversion
-Wno-type-limits -Wno-unsuffixed-float-constants -g -O2 -MT
lib/libcoreutils_a-sm3.o -MD -MP -MF lib/.deps/libcoreutils_a-sm3.Tpo -c -o
lib/libcoreutils_a-sm3.o `test -f 'lib/sm3.c' || echo './'`lib/sm3.c
In file included from
/home/collin/.local/lib/gcc/x86_64-pc-linux-gnu/15.0.0/include/immintrin.h:99:
/home/collin/.local/lib/gcc/x86_64-pc-linux-gnu/15.0.0/include/avx512fp16vlintrin.h:
In function '_mm256_conj_pch':
/home/collin/.local/lib/gcc/x86_64-pc-linux-gnu/15.0.0/include/avx512fp16vlintrin.h:184:80:
warning: result of '1 << 31' requires 33 bits to represent, but 'int' only has
32 bits [-Wshift-overflow=]
  184 |   return (__m256h) _mm256_xor_epi32 ((__m256i) __A,
_mm256_avx512_set1_epi32 (1<<31));
  |
   ^~
/home/collin/.local/lib/gcc/x86_64-pc-linux-gnu/15.0.0/include/avx512fp16vlintrin.h:
In function '_mm_conj_pch':
/home/collin/.local/lib/gcc/x86_64-pc-linux-gnu/15.0.0/include/avx512fp16vlintrin.h:212:74:
warning: result of '1 << 31' requires 33 bits to represent, but 'int' only has
32 bits [-Wshift-overflow=]
  212 |   return (__m128h) _mm_xor_epi32 ((__m128i) __A, _mm_avx512_set1_epi32
(1<<31));
  |
 ^~

I'll read the page you sent and send a patch to gcc-patches referencing this
bug report.

[Bug target/115409] avx512 intrinsics trigger -Wshift-overflow

2024-06-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115409

--- Comment #2 from Andrew Pinski  ---
Note the warning in this case normally does not show up unless you are using
-Wsystem-headers  . We should fix the warning still.

[Bug target/115409] avx512 intrinsics trigger -Wshift-overflow

2024-06-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115409

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2024-06-10
 Status|UNCONFIRMED |NEW

--- Comment #1 from Andrew Pinski  ---
Confirmed.

Note patches should be sent to gcc-patches@ after reading
https://gcc.gnu.org/contribute.html .

Also the warning only happens if you use -Wshift-overflow=2 as documented.

Next time also show the full command line that is used for compiling.