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

gcc: With -frounding-math, gcc-11.5.0-3.el9 miscompiles struct initializers for floats

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Critical Critical
    • rhel-9.6
    • rhel-9.6
    • gcc
    • None
    • rhel-pt-gcc
    • ssg_platform_tools
    • 24
    • 1
    • False
    • False
    • Hide

      None

      Show
      None
    • No
    • Red Hat Enterprise Linux
    • PT GCC 2025 S01
    • Unspecified Release Note Type - Unknown
    • All
    • None

      Reproducer:

      typedef struct
      {
        float x;
      } S;
      S s = { 3.3 };
      

      Without -frounding-math:

              .globl  s
              .data
              .align 4
              .type   s, @object
              .size   s, 4
      s:
              .long   1079194419
              .ident  "GCC: (GNU) 11.5.0 20240719 (Red Hat 11.5.0-3)"
      

      With -frounding-math:

              .globl  s
              .data
              .align 4
              .type   s, @object
              .size   s, 4
      s:
              .long   1717986918
              .long   1074423398
              .ident  "GCC: (GNU) 11.5.0 20240719 (Red Hat 11.5.0-3)"
      

      Note that the struct size did not change, but GCC seems to emit the constant as double.

      Original spotted by skolosov@redhat.com while looking at glibc-2.34-159.el9 failures. I tracked it down from the localedata/tst_swscanf crash: due to the incorrect initializer layout, the test is not able to find the sentinel value that terminates the test case list.

              rhn-support-vkadlcik Vaclav Kadlcik
              fweimer@redhat.com Florian Weimer
              Marek Polacek Marek Polacek
              Vaclav Kadlcik Vaclav Kadlcik
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

                Created:
                Updated:
                Resolved: