public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114370] New: _mm_srli_si128 fails to compile with PCH that uses pragma GCC optimize
@ 2024-03-18  0:00 tellowkrinkle at gmail dot com
  2024-03-18  0:32 ` [Bug pch/114370] __OPTIMIZE__ is still defined after pop_options from a PCH file pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: tellowkrinkle at gmail dot com @ 2024-03-18  0:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114370

            Bug ID: 114370
           Summary: _mm_srli_si128 fails to compile with PCH that uses
                    pragma GCC optimize
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tellowkrinkle at gmail dot com
  Target Milestone: ---

To reproduce:
1. Create the following files:
PCH.h:
        #pragma once

        #pragma GCC push_options
        #pragma GCC optimize("Og")

        struct monostate {
                constexpr monostate() {}
        };

        #pragma GCC pop_options
GSState.cpp:
        #include <immintrin.h>

        __m128i GIFPackedRegHandlerXYZF2(const __m128i* r)
        {
                return _mm_srli_si128(*r, 4);
        }
PCH.cpp: <empty file>

2. `g++ -x c++-header -include PCH.h -c PCH.cpp -o PCH.h.gch`
3. `g++ -include PCH.h -c GSState.cpp -o GSState.o`

(3) fails with
In file included from
/usr/lib/gcc/x86_64-redhat-linux/13/include/xmmintrin.h:1322,
                 from
/usr/lib/gcc/x86_64-redhat-linux/13/include/immintrin.h:31,
                 from GSState.cpp:4:
In function ‘__m128i _mm_srli_si128(__m128i, int)’,
    inlined from ‘__m128i GIFPackedRegHandlerXYZF2(const __m128i*)’ at
GSState.cpp:8:23:
/usr/lib/gcc/x86_64-redhat-linux/13/include/emmintrin.h:1229:10: error: the
last argument must be an 8-bit immediate
 1229 |   return (__m128i)__builtin_ia32_psrldqi128 (__A, __N * 8);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

`gcc -v`:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --enable-libstdcxx-backtrace
--with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu
--enable-plugin --enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-13.2.1-20231205/obj-x86_64-redhat-linux/isl-install
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-offload-defaulted --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
--with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.1 20231205 (Red Hat 13.2.1-6) (GCC)

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

* [Bug pch/114370] __OPTIMIZE__ is still defined after pop_options from a PCH file
  2024-03-18  0:00 [Bug c++/114370] New: _mm_srli_si128 fails to compile with PCH that uses pragma GCC optimize tellowkrinkle at gmail dot com
@ 2024-03-18  0:32 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-18  0:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114370

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looking into PR 48026, I see the patch which was added there is basically this
issue so marking it as a dup.

*** This bug has been marked as a duplicate of bug 48026 ***

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

end of thread, other threads:[~2024-03-18  0:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-18  0:00 [Bug c++/114370] New: _mm_srli_si128 fails to compile with PCH that uses pragma GCC optimize tellowkrinkle at gmail dot com
2024-03-18  0:32 ` [Bug pch/114370] __OPTIMIZE__ is still defined after pop_options from a PCH file pinskia at gcc dot gnu.org

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).