public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/101751] New: asan_test.C fails with excess error with glibc-2.34
@ 2021-08-03 12:43 xry111 at mengyan1223 dot wang
  2021-08-03 12:53 ` [Bug testsuite/101751] " fw at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2021-08-03 12:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101751
           Summary: asan_test.C fails with excess error with glibc-2.34
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xry111 at mengyan1223 dot wang
  Target Milestone: ---

Executing on host: /sources/gcc-11.2.0/build/gcc/testsuite/g++1/../../xg++
-B/sources/gcc-11.2.0/build/gcc/testsuite/g++1/../../ 
/sources/gcc-11.2.0/gcc/testsuite/g++.dg/asan/asan_test.C    -fsanitize=address
-g -I/sources/gcc-11.2.0/gcc/testsuite/../../libsanitizer/include
-fdiagnostics-plain-output  -nostdinc++
-I/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu
-I/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include
-I/sources/gcc-11.2.0/libstdc++-v3/libsupc++
-I/sources/gcc-11.2.0/libstdc++-v3/include/backward
-I/sources/gcc-11.2.0/libstdc++-v3/testsuite/util -fmessage-length=0   -O2 
-std=c++11 -fsanitize=address -fno-builtin -Wall -Werror
-Wno-alloc-size-larger-than -Wno-stringop-overflow -g -DASAN_UAR=0
-DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0 -DSANITIZER_USE_DEJAGNU_GTEST=1
-lasan -lpthread -ldl -DASAN_NEEDS_SEGV=1 -DASAN_AVOID_EXPENSIVE_TESTS=1 -msse2
-D__NO_INLINE__  
/sources/gcc-11.2.0/gcc/testsuite/g++.dg/asan/asan_globals_test-wrapper.cc
-dumpbase ""   -B/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libsanitizer/ 
-B/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libsanitizer/asan/ 
-L/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libsanitizer/asan/.libs  
-L/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libstdc++-v3/src/.libs 
-B/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libstdc++-v3/src/.libs 
-L/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libstdc++-v3/src/.libs
-B/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libitm/
-L/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libitm/.libs -lm  -o
./asan_test.exe    (timeout = 300)
spawn -ignore SIGHUP /sources/gcc-11.2.0/build/gcc/testsuite/g++1/../../xg++
-B/sources/gcc-11.2.0/build/gcc/testsuite/g++1/../../
/sources/gcc-11.2.0/gcc/testsuite/g++.dg/asan/asan_test.C -fsanitize=address -g
-I/sources/gcc-11.2.0/gcc/testsuite/../../libsanitizer/include
-fdiagnostics-plain-output -nostdinc++
-I/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu
-I/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include
-I/sources/gcc-11.2.0/libstdc++-v3/libsupc++
-I/sources/gcc-11.2.0/libstdc++-v3/include/backward
-I/sources/gcc-11.2.0/libstdc++-v3/testsuite/util -fmessage-length=0 -O2
-std=c++11 -fsanitize=address -fno-builtin -Wall -Werror
-Wno-alloc-size-larger-than -Wno-stringop-overflow -g -DASAN_UAR=0
-DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0 -DSANITIZER_USE_DEJAGNU_GTEST=1
-lasan -lpthread -ldl -DASAN_NEEDS_SEGV=1 -DASAN_AVOID_EXPENSIVE_TESTS=1 -msse2
-D__NO_INLINE__
/sources/gcc-11.2.0/gcc/testsuite/g++.dg/asan/asan_globals_test-wrapper.cc
-dumpbase  -B/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libsanitizer/
-B/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libsanitizer/asan/
-L/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libsanitizer/asan/.libs
-L/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libstdc++-v3/src/.libs
-B/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libstdc++-v3/src/.libs
-L/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libstdc++-v3/src/.libs
-B/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libitm/
-L/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/./libitm/.libs -lm -o
./asan_test.exe
In file included from
/sources/gcc-11.2.0/gcc/testsuite/g++.dg/asan/asan_test.C:15:
In function 'void* TSDWorker(void*)',
    inlined from 'void* TSDWorker(void*)' at
/sources/gcc-11.2.0/gcc/testsuite/g++.dg/asan/asan_test.cc:141:7:
/sources/gcc-11.2.0/gcc/testsuite/g++.dg/asan/asan_test.cc:143:24: error: 'int
pthread_setspecific(pthread_key_t, const void*)' expecting 1 byte in a region
of size 0 [-Werror=stringop-overread]
In file included from
/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:35,
                 from
/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr.h:148,
                 from
/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/atomicity.h:35,
                 from
/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:39,
                 from
/sources/gcc-11.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include/string:55,
                 from
/sources/gcc-11.2.0/gcc/testsuite/g++.dg/asan/asan_test_config.h:19,
                 from
/sources/gcc-11.2.0/gcc/testsuite/g++.dg/asan/asan_test_utils.h:17,
                 from
/sources/gcc-11.2.0/gcc/testsuite/g++.dg/asan/asan_test.cc:11,
                 from
/sources/gcc-11.2.0/gcc/testsuite/g++.dg/asan/asan_test.C:15:
/sources/gcc-11.2.0/build/gcc/include-fixed/pthread.h: In function 'void*
TSDWorker(void*)':
/sources/gcc-11.2.0/build/gcc/include-fixed/pthread.h:1317:12: note: in a call
to function 'int pthread_setspecific(pthread_key_t, const void*)' declared with
attribute 'access (none, 2)'
cc1plus: all warnings being treated as errors
compiler exited with status 1
FAIL: g++.dg/asan/asan_test.C   -O2  (test for excess errors)

It seems because glibc-2.34 has introduced __attribute__((__access__(...))) for
pthread_setspecific.

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

* [Bug testsuite/101751] asan_test.C fails with excess error with glibc-2.34
  2021-08-03 12:43 [Bug testsuite/101751] New: asan_test.C fails with excess error with glibc-2.34 xry111 at mengyan1223 dot wang
@ 2021-08-03 12:53 ` fw at gcc dot gnu.org
  2021-08-03 15:42 ` msebor at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fw at gcc dot gnu.org @ 2021-08-03 12:53 UTC (permalink / raw)
  To: gcc-bugs

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

Florian Weimer <fw at gcc dot gnu.org> changed:

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

--- Comment #1 from Florian Weimer <fw at gcc dot gnu.org> ---
Martin and I discussed this before. I believe the use of attribute access with
pthread_setspecific is quite wrong because it does not dereference the pointer
at all.

Consider this example:

#include <pthread.h>
#include <sys/mman.h>

void
f (pthread_key_t key)
{
  pthread_setspecific (key, MAP_FAILED);
}

There is no way POSIX would consider this code invalid, but yet we warn:

t.c: In function ‘f’:
t.c:7:3: warning: ‘pthread_setspecific’ expecting 1 byte in a region of size 0
[-Wstringop-overread]
    7 |   pthread_setspecific (key, MAP_FAILED);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from t.c:1:
/usr/include/pthread.h:1308:12: note: in a call to function
‘pthread_setspecific’ declared with attribute ‘access (none, 2)’
 1308 | extern int pthread_setspecific (pthread_key_t __key,
      |            ^~~~~~~~~~~~~~~~~~~


Removing attribute access is not a solution because the warning is implied by
the const void * argument type already. Access type none is merely declaration
that the pointed-to memory need not be initialized, it still needs to be a
valid address.

So yes, I consider this a GCC diagnostics bug: not for access type none, but
the fact that the diagnostic cannot be disabled at all for functions like
pthread_setspecific.

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

* [Bug testsuite/101751] asan_test.C fails with excess error with glibc-2.34
  2021-08-03 12:43 [Bug testsuite/101751] New: asan_test.C fails with excess error with glibc-2.34 xry111 at mengyan1223 dot wang
  2021-08-03 12:53 ` [Bug testsuite/101751] " fw at gcc dot gnu.org
@ 2021-08-03 15:42 ` msebor at gcc dot gnu.org
  2021-11-30 10:13 ` fw at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-08-03 15:42 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
   Last reconfirmed|                            |2021-08-03
   Target Milestone|---                         |11.3
     Ever confirmed|0                           |1

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Here's the discussion for reference:
https://sourceware.org/pipermail/libc-alpha/2021-April/125589.html

I said I'd look into elaxing how the combination of void* and attribute access
none is handled in GCC 11.2 but it slipped my mind.  Let me do that for 11.3.

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

* [Bug testsuite/101751] asan_test.C fails with excess error with glibc-2.34
  2021-08-03 12:43 [Bug testsuite/101751] New: asan_test.C fails with excess error with glibc-2.34 xry111 at mengyan1223 dot wang
  2021-08-03 12:53 ` [Bug testsuite/101751] " fw at gcc dot gnu.org
  2021-08-03 15:42 ` msebor at gcc dot gnu.org
@ 2021-11-30 10:13 ` fw at gcc dot gnu.org
  2021-12-09 18:28 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fw at gcc dot gnu.org @ 2021-11-30 10:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Florian Weimer <fw at gcc dot gnu.org> ---
Patch posted:

[PATCH] Avoid expecting nonzero size for access none void* arguments [PR101751]
https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585377.html

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

* [Bug testsuite/101751] asan_test.C fails with excess error with glibc-2.34
  2021-08-03 12:43 [Bug testsuite/101751] New: asan_test.C fails with excess error with glibc-2.34 xry111 at mengyan1223 dot wang
                   ` (2 preceding siblings ...)
  2021-11-30 10:13 ` fw at gcc dot gnu.org
@ 2021-12-09 18:28 ` cvs-commit at gcc dot gnu.org
  2021-12-12  0:08 ` xry111 at mengyan1223 dot wang
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-09 18:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:

https://gcc.gnu.org/g:9eeca99ccce4b56765920bd3c839abb77bbd4280

commit r12-5870-g9eeca99ccce4b56765920bd3c839abb77bbd4280
Author: Martin Sebor <msebor@redhat.com>
Date:   Thu Dec 9 11:24:14 2021 -0700

    Avoid expecting nonzero size for access none void* arguments [PR101751].

    Resolves:
    PR middle-end/101751 - attribute access none with void pointer expects
nonzero size

    gcc/ChangeLog:

            PR middle-end/101751
            * doc/extend.texi (attribute access): Adjust.
            * gimple-ssa-warn-access.cc
(pass_waccess::maybe_check_access_sizes):
            Treat access mode none on a void* argument as expecting as few as
            zero bytes.

    gcc/testsuite/ChangeLog:

            PR middle-end/101751
            * gcc.dg/Wstringop-overflow-86.c: New test.

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

* [Bug testsuite/101751] asan_test.C fails with excess error with glibc-2.34
  2021-08-03 12:43 [Bug testsuite/101751] New: asan_test.C fails with excess error with glibc-2.34 xry111 at mengyan1223 dot wang
                   ` (3 preceding siblings ...)
  2021-12-09 18:28 ` cvs-commit at gcc dot gnu.org
@ 2021-12-12  0:08 ` xry111 at mengyan1223 dot wang
  2021-12-16 23:04 ` cvs-commit at gcc dot gnu.org
  2021-12-16 23:05 ` [Bug middle-end/101751] " msebor at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2021-12-12  0:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
Will the patch be backported to gcc-11 branch?

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

* [Bug testsuite/101751] asan_test.C fails with excess error with glibc-2.34
  2021-08-03 12:43 [Bug testsuite/101751] New: asan_test.C fails with excess error with glibc-2.34 xry111 at mengyan1223 dot wang
                   ` (4 preceding siblings ...)
  2021-12-12  0:08 ` xry111 at mengyan1223 dot wang
@ 2021-12-16 23:04 ` cvs-commit at gcc dot gnu.org
  2021-12-16 23:05 ` [Bug middle-end/101751] " msebor at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-16 23:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Martin Sebor
<msebor@gcc.gnu.org>:

https://gcc.gnu.org/g:5635c975576604afda35543f672c2cad79cb0046

commit r11-9397-g5635c975576604afda35543f672c2cad79cb0046
Author: Martin Sebor <msebor@redhat.com>
Date:   Thu Dec 9 11:24:14 2021 -0700

    Avoid expecting nonzero size for access none void* arguments [PR101751].

    Resolves:
    PR middle-end/101751 - attribute access none with void pointer expects
nonzero size

    gcc/ChangeLog:

            PR middle-end/101751
            * doc/extend.texi (attribute access): Adjust.
            * calls.c (maybe_warn_rdwr_sizes): Treat access mode none on a
void*
            argument as expecting as few as zero bytes.

    gcc/testsuite/ChangeLog:

            PR middle-end/101751
            * gcc.dg/Wstringop-overflow-86.c: New test.

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

* [Bug middle-end/101751] asan_test.C fails with excess error with glibc-2.34
  2021-08-03 12:43 [Bug testsuite/101751] New: asan_test.C fails with excess error with glibc-2.34 xry111 at mengyan1223 dot wang
                   ` (5 preceding siblings ...)
  2021-12-16 23:04 ` cvs-commit at gcc dot gnu.org
@ 2021-12-16 23:05 ` msebor at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-12-16 23:05 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|testsuite                   |middle-end
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed in GCC 12 and 11.

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

end of thread, other threads:[~2021-12-16 23:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 12:43 [Bug testsuite/101751] New: asan_test.C fails with excess error with glibc-2.34 xry111 at mengyan1223 dot wang
2021-08-03 12:53 ` [Bug testsuite/101751] " fw at gcc dot gnu.org
2021-08-03 15:42 ` msebor at gcc dot gnu.org
2021-11-30 10:13 ` fw at gcc dot gnu.org
2021-12-09 18:28 ` cvs-commit at gcc dot gnu.org
2021-12-12  0:08 ` xry111 at mengyan1223 dot wang
2021-12-16 23:04 ` cvs-commit at gcc dot gnu.org
2021-12-16 23:05 ` [Bug middle-end/101751] " msebor at gcc dot gnu.org

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