GCC fails to recognize constants as immediates for SIMD intrinsics such as `_mm_srli_si128` when using a precompiled header (PCH) built from a header that temporarily applies `#pragma GCC optimize("Og")` inside `#pragma GCC push_options` / `#pragma GCC pop_options`. This is not a case where the PCH is built and used with different command-line optimization flags. The command-line flags match. The only optimization change is the scoped pragma inside the header, and that state is restored before the end of the header. Minimal source files: `pch.hxx` ```cpp #pragma GCC push_options #pragma GCC optimize("Og") #include <bits/c++config.h> #pragma GCC pop_options ``` `repro.cpp` ```cpp #include <emmintrin.h> void f() { __m128i x = _mm_setzero_si128(); x = _mm_srli_si128(x, 2); } ``` Reproducible: Always Steps to Reproduce: g++ -x c++-header -std=c++20 -g -Winvalid-pch \ -include ./pch.hxx \ -o ./pch.hxx.gch \ -c pch.hxx.cxx g++ -std=c++20 -g -Winvalid-pch \ -include ./pch.hxx \ -c repro.cpp # control: same source without PCH g++ -std=c++20 -g -c repro.cpp Actual Results: In function ‘__m128i _mm_srli_si128(__m128i, int)’, inlined from ‘void f()’ at repro.cpp:5:20: /usr/lib/gcc/.../include/emmintrin.h:1230:10: error: the last argument must be an 8-bit immediate Expected Results: Compilation should succeed. The literal `2` should be recognized as an immediate. The same `repro.cpp` compiles successfully without PCH. Additional Information: - The reproducer uses the same command-line flags for PCH creation and use: `-std=c++20 -g`. - The same `repro.cpp` compiles successfully without PCH. - `emmintrin.h` changes some intrinsic definitions based on `__OPTIMIZE__`, so this appears related to pragma-driven optimization state during PCH save/load. - This can be triggered by common libraries such as `fmt`, but the attached reproducer is non-`fmt`, so `fmt` is only one trigger path. - Maybe related to PR c++/48026 (early pragma handling), but the issue still reproduces with GCC 16.0.1 on Fedora Rawhide. Fedora 43 / GCC 15.2.1: ```bash $ g++ -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,cobol,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugzilla.redhat.com/ --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-15.2.1-build/gcc-15.2.1-20260123/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none,amdgcn-amdhsa --enable-offload-defaulted --without-cuda-driver --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 --disable-libssp Thread model: posix gcc version 15.2.1 20260123 (Red Hat 15.2.1-7) (GCC) $ cat /etc/fedora-release Fedora release 43 (Forty Three) $ rpm -qa | grep -E "^(gcc|fmt)-[0-9].*x86_64" fmt-11.2.0-3.fc43.x86_64 gcc-15.2.1-7.fc43.x86_64 ``` Fedora Rawhide / GCC 16.0.1: ```bash $ g++ -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,cobol,algol68,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugzilla.redhat.com/ --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-16.0.1-build/gcc-16.0.1-20260321/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none,amdgcn-amdhsa --enable-offload-defaulted --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-tls=gnu2 --with-arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1 --disable-libssp Thread model: posix gcc version 16.0.1 20260321 (Red Hat 16.0.1-0) (GCC) $ cat /etc/fedora-release Fedora release 45 (Rawhide) $ rpm -qa | grep -E "^gcc-[0-9].*x86_64" gcc-16.0.1-0.10.fc45.x86_64 ```