Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-150603

gcc-toolset-15-gcc: g++ compilation issue with -O3

Linking RHIVOS CVEs to...Migration: Automation ...Sync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • rhel-9.8.z
    • rhel-9.7
    • gcc-toolset-15-gcc
    • None
    • Yes
    • Low
    • rhel-pt-gcc-1
    • 1
    • False
    • False
    • Hide

      None

      Show
      None
    • No
    • None
    • None
    • None
    • Unspecified Release Note Type - Unknown
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      The following code can no longer be compiled properly with gcc-15 and -O3:

       

      # cat test.cpp 
      #include <sstream>
      #include <string>
      #include <print>
      #include <chrono>
      
      int main()
      {
          std::istringstream iss("Jun 22");
          std::chrono::year_month ym;
          iss >> std::chrono::parse("%b%t%y", ym);
          std::print("{} {}", iss.fail(), ym);
          return 0;
      }
      

      Compiling it thus and running it yields the wrong output:

      [root@r810 ~]# /opt/rh/gcc-toolset-15/root/usr/bin/g++ test.cpp -o test -std=c++26 -O3
      [root@r810 ~]# ./test
      true 0000/0 is not a valid month 

      This used to work fine with gcc-toolset-14:

      [root@r810 ~]# /opt/rh/gcc-toolset-14/root/usr/bin/g++ test.cpp -o test -std=c++26 -O3
      [root@r810 ~]# ./test
      false 2022/Jun 

      It also works fine with -O0:

      [root@r810 ~]# /opt/rh/gcc-toolset-15/root/usr/bin/g++ test.cpp -o test -std=c++26 -O0
      [root@r810 ~]# ./test
      false 2022/Jun 

       

       

              sst-pt-gcc-issues SST PT GCC Bot
              rhn-support-jsantos Juan Santos
              SST PT GCC Bot SST PT GCC Bot
              Vaclav Kadlcik Vaclav Kadlcik
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated: