public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug stdio/26690] New: Aliasing violation in __vfscanf_internal
@ 2020-10-01 11:53 schwab@linux-m68k.org
  2020-10-01 11:55 ` [Bug stdio/26690] " schwab@linux-m68k.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: schwab@linux-m68k.org @ 2020-10-01 11:53 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26690

            Bug ID: 26690
           Summary: Aliasing violation in __vfscanf_internal
           Product: glibc
           Version: 2.22
            Status: NEW
          Severity: normal
          Priority: P2
         Component: stdio
          Assignee: unassigned at sourceware dot org
          Reporter: schwab@linux-m68k.org
  Target Milestone: ---

As noted in <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97264>, the cast
in the call to the read_int function in __vfscanf_internal is an aliasing
violation.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug stdio/26690] Aliasing violation in __vfscanf_internal
  2020-10-01 11:53 [Bug stdio/26690] New: Aliasing violation in __vfscanf_internal schwab@linux-m68k.org
@ 2020-10-01 11:55 ` schwab@linux-m68k.org
  2020-10-01 21:41 ` slyfox at inbox dot ru
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: schwab@linux-m68k.org @ 2020-10-01 11:55 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26690

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.22                        |2.25

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
Introduced in commit 726d48ec96.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug stdio/26690] Aliasing violation in __vfscanf_internal
  2020-10-01 11:53 [Bug stdio/26690] New: Aliasing violation in __vfscanf_internal schwab@linux-m68k.org
  2020-10-01 11:55 ` [Bug stdio/26690] " schwab@linux-m68k.org
@ 2020-10-01 21:41 ` slyfox at inbox dot ru
  2020-10-06  9:56 ` nsz at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: slyfox at inbox dot ru @ 2020-10-01 21:41 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26690

Sergei Trofimovich <slyfox at inbox dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |slyfox at inbox dot ru

--- Comment #2 from Sergei Trofimovich <slyfox at inbox dot ru> ---
Created attachment 12883
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12883&action=edit
glibc-9999-alias.patch

To add more color on the breakage: gcc-11 added new -fipa-modref optimization
(enabled by default on -O and above) which is able to eliminate "dead" stores
on pointers of incompatible types.

Attaching glibc-9999-alias.patch as a proof of concept fix that happens to
unbreak glibc on gcc-11 for me.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug stdio/26690] Aliasing violation in __vfscanf_internal
  2020-10-01 11:53 [Bug stdio/26690] New: Aliasing violation in __vfscanf_internal schwab@linux-m68k.org
  2020-10-01 11:55 ` [Bug stdio/26690] " schwab@linux-m68k.org
  2020-10-01 21:41 ` slyfox at inbox dot ru
@ 2020-10-06  9:56 ` nsz at gcc dot gnu.org
  2020-10-07 18:43 ` tuliom at ascii dot art.br
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: nsz at gcc dot gnu.org @ 2020-10-06  9:56 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26690

Szabolcs Nagy <nsz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nsz at gcc dot gnu.org

--- Comment #3 from Szabolcs Nagy <nsz at gcc dot gnu.org> ---
i'm seeing this on aarch64 too: crypt/cert test case
does not finish reading the input and fills up the disk:

$ ./testrun.sh crypt/cert < $glibcsrc/crypt/cert.input
 K: 0000000000000000 P: 0000000000000000 C: 0000000000000000 Encrypt FAIL
 K: 0000000000000000 P: 0000000000000000 C: 0000000000000000 Encrypt FAIL
 K: 0000000000000000 P: 0000000000000000 C: 0000000000000000 Encrypt FAIL
 K: 0000000000000000 P: 0000000000000000 C: 0000000000000000 Encrypt FAIL
 K: 0000000000000000 P: 0000000000000000 C: 0000000000000000 Encrypt FAIL
...

a cut down test case:

#include <stdio.h>
int main()
{
        int r,t;
        r = sscanf("01", "%2x", &t);
        printf("scanf: %d  %02x\n", r, t);
        return 0;
}

with new gcc it prints

scanf: 0  00

with the patch from #c2 i get the expected

scanf: 1  01

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug stdio/26690] Aliasing violation in __vfscanf_internal
  2020-10-01 11:53 [Bug stdio/26690] New: Aliasing violation in __vfscanf_internal schwab@linux-m68k.org
                   ` (2 preceding siblings ...)
  2020-10-06  9:56 ` nsz at gcc dot gnu.org
@ 2020-10-07 18:43 ` tuliom at ascii dot art.br
  2020-10-08  8:16 ` schwab@linux-m68k.org
  2020-10-08 17:36 ` slyfox at inbox dot ru
  5 siblings, 0 replies; 7+ messages in thread
From: tuliom at ascii dot art.br @ 2020-10-07 18:43 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26690

Tulio Magno Quites Machado Filho <tuliom at ascii dot art.br> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tuliom at ascii dot art.br

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug stdio/26690] Aliasing violation in __vfscanf_internal
  2020-10-01 11:53 [Bug stdio/26690] New: Aliasing violation in __vfscanf_internal schwab@linux-m68k.org
                   ` (3 preceding siblings ...)
  2020-10-07 18:43 ` tuliom at ascii dot art.br
@ 2020-10-08  8:16 ` schwab@linux-m68k.org
  2020-10-08 17:36 ` slyfox at inbox dot ru
  5 siblings, 0 replies; 7+ messages in thread
From: schwab@linux-m68k.org @ 2020-10-08  8:16 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26690

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.33
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> ---
Fixed in 2.33.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug stdio/26690] Aliasing violation in __vfscanf_internal
  2020-10-01 11:53 [Bug stdio/26690] New: Aliasing violation in __vfscanf_internal schwab@linux-m68k.org
                   ` (4 preceding siblings ...)
  2020-10-08  8:16 ` schwab@linux-m68k.org
@ 2020-10-08 17:36 ` slyfox at inbox dot ru
  5 siblings, 0 replies; 7+ messages in thread
From: slyfox at inbox dot ru @ 2020-10-08 17:36 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26690

--- Comment #5 from Sergei Trofimovich <slyfox at inbox dot ru> ---
Thank you!

Linking fix here for posterity:
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=c0e9ddf59e73e21afe15fca4e94cf7b4b7359bf2

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2020-10-08 17:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-01 11:53 [Bug stdio/26690] New: Aliasing violation in __vfscanf_internal schwab@linux-m68k.org
2020-10-01 11:55 ` [Bug stdio/26690] " schwab@linux-m68k.org
2020-10-01 21:41 ` slyfox at inbox dot ru
2020-10-06  9:56 ` nsz at gcc dot gnu.org
2020-10-07 18:43 ` tuliom at ascii dot art.br
2020-10-08  8:16 ` schwab@linux-m68k.org
2020-10-08 17:36 ` slyfox at inbox dot ru

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