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

            Bug ID: 117800
           Summary: [12/13/14/15 regression] libscrypt miscompiled since
                    r11-4586-g617695cdc2b3d9
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
                CC: fxcoudert at gcc dot gnu.org, hubicka at gcc dot gnu.org
  Target Milestone: ---

Created attachment 59717
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59717&action=edit
crypto_scrypt-nosse.c

Reported downstream in Gentoo at https://bugs.gentoo.org/931556 as well as
upstream at https://github.com/technion/libscrypt/issues/60 where FX appears
(hi!)

The bug is interesting in that it appears to have exposed an (Apple?) Clang bug
as well and it makes me wonder if the testcase is really well-defined, but I
can't yet find a reason for to be undefined.

10 is fine, 11..15 aren't. It needs -O3.

```
$ gcc crypto_scrypt-nosse.c -o crypto_scrypt-nosse -O2 && ./crypto_scrypt-nosse
crypto_scrypt-nosse.c:13:6: warning: array ‘libscrypt_SHA256_Final_len’ assumed
to have one element
   13 | char libscrypt_SHA256_Final_len[], libscrypt_HMAC_SHA256_Init_pad[];
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
crypto_scrypt-nosse.c:13:36: warning: array ‘libscrypt_HMAC_SHA256_Init_pad’
assumed to have one element
   13 | char libscrypt_SHA256_Final_len[], libscrypt_HMAC_SHA256_Init_pad[];
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$ gcc crypto_scrypt-nosse.c -o crypto_scrypt-nosse -O3 && ./crypto_scrypt-nosse
crypto_scrypt-nosse.c:13:6: warning: array ‘libscrypt_SHA256_Final_len’ assumed
to have one element
   13 | char libscrypt_SHA256_Final_len[], libscrypt_HMAC_SHA256_Init_pad[];
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
crypto_scrypt-nosse.c:13:36: warning: array ‘libscrypt_HMAC_SHA256_Init_pad’
assumed to have one element
   13 | char libscrypt_SHA256_Final_len[], libscrypt_HMAC_SHA256_Init_pad[];
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Aborted                    (core dumped) ./crypto_scrypt-nosse
```

Reply via email to