public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/107940] New: temp_directory_path testcase broken
@ 2022-11-30 20:47 laurent.alfonsi at linaro dot org
  2022-11-30 22:00 ` [Bug libstdc++/107940] " redi at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: laurent.alfonsi at linaro dot org @ 2022-11-30 20:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107940
           Summary: temp_directory_path testcase broken
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: laurent.alfonsi at linaro dot org
  Target Milestone: ---

Testcase of gnu testsuite 
  
libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc

sometimes crashes and leaves a directory with broken user/permissions. i.e :
    $ ls -lrt
builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/gcc-gcc.git~master-stage2/aarch64-linux-gnu/libstdc++-v3/testsuite/normal14/filesystem-test.temp_directory_path.193969877.WdDDBh/
    ls: cannot access
'builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/gcc-gcc.git~master-stage2/aarch64-linux-gnu/libstdc++-v3/testsuite/normal14/filesystem-test.temp_directory_path.193969877.WdDDBh/tmp':
Permission denied
    total 0
    d????????? ? ? ? ?            ? tmp

It is probably useless but here are the cmd launched by dejagnu to build this
test :
    ABE=$PWD
    $PWD/builds/destdir/x86_64-pc-linux-gnu/bin/aarch64-linux-gnu-g++ \
    
-B$ABE/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/gcc-$GCCVER-stage2/./gcc \
     -nostdinc++ \
    
-L$ABE/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/gcc-$GCCVER-stage2/aarch64-linux-gnu/libstdc++-v3/src
\
    
-L$ABE/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/gcc-$GCCVER-stage2/aarch64-linux-gnu/libstdc++-v3/src/.libs
\
    
-L$ABE/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/gcc-$GCCVER-stage2/aarch64-linux-gnu/libstdc++-v3/libsupc++/.libs
\
     -B$ABE/builds/destdir/x86_64-pc-linux-gnu/aarch64-linux-gnu/bin/ \
     -B$ABE/builds/destdir/x86_64-pc-linux-gnu/aarch64-linux-gnu/lib/ \
     -isystem $ABE/builds/destdir/x86_64-pc-linux-gnu/aarch64-linux-gnu/include
\
     -isystem
$ABE/builds/destdir/x86_64-pc-linux-gnu/aarch64-linux-gnu/sys-include \
    
-B$ABE/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/gcc-$GCCVER-stage2/aarch64-linux-gnu/./libstdc++-v3/src/.libs
\
     -O1  \
     -D_GNU_SOURCE \
     -DLOCALEDIR="." \
     -nostdinc++ \
    
-I$ABE/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/gcc-$GCCVER-stage2/aarch64-linux-gnu/libstdc++-v3/include/aarch64-linux-gnu
\
    
-I$ABE/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/gcc-$GCCVER-stage2/aarch64-linux-gnu/libstdc++-v3/include
\
     -I$ABE/snapshots/$GCCVER/libstdc++-v3/libsupc++ \
     -I$ABE/snapshots/$GCCVER/libstdc++-v3/include/backward \
     -I$ABE/snapshots/$GCCVER/libstdc++-v3/testsuite/util \
    
$ABE/snapshots/gcc~master/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc
\
     -DUSE_FILESYSTEM_TS \
     -lstdc++fs \
     -Wl,--gc-sections \
    
-L$ABE/builds/x86_64-pc-linux-gnu/aarch64-linux-gnu/gcc-$GCCVER-stage2/aarch64-linux-gnu/libstdc++-v3/src/filesystem/.libs
\
     -lm -g -static \
     -o ./temp_directory_path.exe

The test sometimes crashes while running temp_directory_path.exe
- crashes with O2, ok with O1.
- crashes when using qemu-aarch64 v7.2.0-rc0-24-g98f10f0e26, ok with qemu
v7.2.0-rc2-19-gac14949821
- on native aa64, and it seems to work.
- But valgrind reports many uninitialized values, ...
Which explain this instability to pass/fail.

sanitizer=address reports an issue while stack unwinding :

    ==13419==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000
(pc 0x0055012adf14 bp 0x0055007ff090 sp 0x0055007ff090 T0)
    ==13419==The signal is caused by a UNKNOWN memory access.
    ==13419==Hint: address points to the zero page.
        #0 0x55012adf14 in aarch64_fallback_frame_state md-unwind-support.h:74
        #1 0x55012adf14 in uw_frame_state_for
/home/tcwg-buildslave/workspace/tcwg_gnu_1/abe/snapshots/gcc.git~master/libgcc/unwind-dw2.c:1275
        #2 0x55012af2f8 in _Unwind_RaiseException
/home/tcwg-buildslave/workspace/tcwg_gnu_1/abe/snapshots/gcc.git~master/libgcc/unwind.inc:104
        #3 0x550106e5c0 in __cxa_throw
/home/tcwg-buildslave/workspace/tcwg_gnu_1/abe/snapshots/gcc.git~master/libstdc++-v3/libsupc++/eh_throw.cc:93
        #4 0x4141c4 in
std::experimental::filesystem::v1::temp_directory_path[abi:cxx11]()
/home/laurent.alfonsi/abe/snapshots/gcc.git~master/libstdc++-v3/src/filesystem/ops.cc:1337
        #5 0x40deb8 in test03()
/home/laurent.alfonsi/abe/snapshots/gcc~master/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc:121
        #6 0x4034cc in main
/home/laurent.alfonsi/abe/snapshots/gcc~master/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc:162
        #7 0x550130b2e8 in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
        #8 0x550130b3b8 in __libc_start_main_impl ../csu/libc-start.c:381
        #9 0x403aec in _start
(/home/laurent.alfonsi/abe/temp_directory_path.exe+0x403aec) (BuildId:
be39c337f0ff0a3afba1bb02d7ff75402eb15fb4)

    AddressSanitizer can not provide additional info.
    SUMMARY: AddressSanitizer: SEGV md-unwind-support.h:74 in
aarch64_fallback_frame_state
    ==13419==ABORTING

This may be linked to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90787.
But, I confirm my toolchain is based on trunk (13.0), and contains the 90787
fix.

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

* [Bug libstdc++/107940] temp_directory_path testcase broken
  2022-11-30 20:47 [Bug libstdc++/107940] New: temp_directory_path testcase broken laurent.alfonsi at linaro dot org
@ 2022-11-30 22:00 ` redi at gcc dot gnu.org
  2022-11-30 22:06 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-30 22:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to laurent.alfonsi@linaro.org from comment #0)
> This may be linked to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90787.
> But, I confirm my toolchain is based on trunk (13.0), and contains the 90787
> fix.

No, I don't think it's related to that in any way.

valgrind and asan are both clean when running that test on x86_64-pc-linux-gnu.

Where does valgrind say there are uninitialized values? Maybe the problem is in
the unwinder.

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

* [Bug libstdc++/107940] temp_directory_path testcase broken
  2022-11-30 20:47 [Bug libstdc++/107940] New: temp_directory_path testcase broken laurent.alfonsi at linaro dot org
  2022-11-30 22:00 ` [Bug libstdc++/107940] " redi at gcc dot gnu.org
@ 2022-11-30 22:06 ` pinskia at gcc dot gnu.org
  2022-11-30 22:29 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-30 22:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> (In reply to laurent.alfonsi@linaro.org from comment #0)
> > This may be linked to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90787.
> > But, I confirm my toolchain is based on trunk (13.0), and contains the 90787
> > fix.
> 
> No, I don't think it's related to that in any way.
> 
> valgrind and asan are both clean when running that test on
> x86_64-pc-linux-gnu.
> 
> Where does valgrind say there are uninitialized values? Maybe the problem is
> in the unwinder.

I suspect the problem is the unwinder which is why I put PR 107678 and PR
107675 as see also bug reports. Both are those are aarch64 specific issues
relating to unwind issues against the trunk. This might be the same issue there
too.

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

* [Bug libstdc++/107940] temp_directory_path testcase broken
  2022-11-30 20:47 [Bug libstdc++/107940] New: temp_directory_path testcase broken laurent.alfonsi at linaro dot org
  2022-11-30 22:00 ` [Bug libstdc++/107940] " redi at gcc dot gnu.org
  2022-11-30 22:06 ` pinskia at gcc dot gnu.org
@ 2022-11-30 22:29 ` redi at gcc dot gnu.org
  2022-11-30 22:49 ` laurent.alfonsi at linaro dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-30 22:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Thanks, Andrew, I hadn't noticed the See Also links. I agree this looks
related.

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

* [Bug libstdc++/107940] temp_directory_path testcase broken
  2022-11-30 20:47 [Bug libstdc++/107940] New: temp_directory_path testcase broken laurent.alfonsi at linaro dot org
                   ` (2 preceding siblings ...)
  2022-11-30 22:29 ` redi at gcc dot gnu.org
@ 2022-11-30 22:49 ` laurent.alfonsi at linaro dot org
  2022-12-01 14:23 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: laurent.alfonsi at linaro dot org @ 2022-11-30 22:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from laurent.alfonsi at linaro dot org <laurent.alfonsi at linaro dot org> ---
(In reply to Jonathan Wakely from comment #1)
> (In reply to laurent.alfonsi@linaro.org from comment #0)
> > This may be linked to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90787.
> > But, I confirm my toolchain is based on trunk (13.0), and contains the 90787
> > fix.
> 
> No, I don't think it's related to that in any way.
> 
> valgrind and asan are both clean when running that test on
> x86_64-pc-linux-gnu.
> 
> Where does valgrind say there are uninitialized values? Maybe the problem is
> in the unwinder.

Plenty places : "More than 1000 different errors detected"

Many are from init phase :
==47392== Conditional jump or move depends on uninitialised value(s)
==47392==    at 0x497FB0: malloc 
==47392==    by 0x4C6E23: _dl_get_origin
==47392==    by 0x4B0A0F: _dl_non_dynamic_init
==47392==    by 0x4B147B: __libc_init_first
==47392==    by 0x469DBB: (below main)

Then from the testcase itself (test02): 
==47392== Conditional jump or move depends on uninitialised value(s)
==47392==    at 0x498034: malloc 
==47392==    by 0x40C70B: operator new(unsigned long) 
==47392==    by 0x401923: void std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char
const*, char const*, std::forward_iterator_tag) [clone .isra.0]
==47392==    by 0x4036F3: test02() 
==47392==    by 0x400DDB: main 

test03 : 
==47392== Conditional jump or move depends on uninitialised value(s)
==47392==    at 0x47B6F4: unsetenv 
==47392==    by 0x403FBF: test03() 
==47392==    by 0x400DDF: main

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

* [Bug libstdc++/107940] temp_directory_path testcase broken
  2022-11-30 20:47 [Bug libstdc++/107940] New: temp_directory_path testcase broken laurent.alfonsi at linaro dot org
                   ` (3 preceding siblings ...)
  2022-11-30 22:49 ` laurent.alfonsi at linaro dot org
@ 2022-12-01 14:23 ` redi at gcc dot gnu.org
  2022-12-01 16:50 ` laurent.alfonsi at linaro dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2022-12-01 14:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Something seems very broken, and I don't think it's libstdc++.

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

* [Bug libstdc++/107940] temp_directory_path testcase broken
  2022-11-30 20:47 [Bug libstdc++/107940] New: temp_directory_path testcase broken laurent.alfonsi at linaro dot org
                   ` (4 preceding siblings ...)
  2022-12-01 14:23 ` redi at gcc dot gnu.org
@ 2022-12-01 16:50 ` laurent.alfonsi at linaro dot org
  2022-12-01 19:57 ` pinskia at gcc dot gnu.org
  2022-12-03 21:24 ` laurent.alfonsi at linaro dot org
  7 siblings, 0 replies; 9+ messages in thread
From: laurent.alfonsi at linaro dot org @ 2022-12-01 16:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from laurent.alfonsi at linaro dot org <laurent.alfonsi at linaro dot org> ---
testing with other versions.

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

* [Bug libstdc++/107940] temp_directory_path testcase broken
  2022-11-30 20:47 [Bug libstdc++/107940] New: temp_directory_path testcase broken laurent.alfonsi at linaro dot org
                   ` (5 preceding siblings ...)
  2022-12-01 16:50 ` laurent.alfonsi at linaro dot org
@ 2022-12-01 19:57 ` pinskia at gcc dot gnu.org
  2022-12-03 21:24 ` laurent.alfonsi at linaro dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-01 19:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to laurent.alfonsi@linaro.org from comment #0)
> sanitizer=address reports an issue while stack unwinding :
> 
>     ==13419==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000
> (pc 0x0055012adf14 bp 0x0055007ff090 sp 0x0055007ff090 T0)
>     ==13419==The signal is caused by a UNKNOWN memory access.
>     ==13419==Hint: address points to the zero page.

The uninitialized memory dealing with the stack unwinding is recorded as PR
107678 and a patch was sent here:
https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607668.html (maybe that
will fix the issue recorded here too).

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

* [Bug libstdc++/107940] temp_directory_path testcase broken
  2022-11-30 20:47 [Bug libstdc++/107940] New: temp_directory_path testcase broken laurent.alfonsi at linaro dot org
                   ` (6 preceding siblings ...)
  2022-12-01 19:57 ` pinskia at gcc dot gnu.org
@ 2022-12-03 21:24 ` laurent.alfonsi at linaro dot org
  7 siblings, 0 replies; 9+ messages in thread
From: laurent.alfonsi at linaro dot org @ 2022-12-03 21:24 UTC (permalink / raw)
  To: gcc-bugs

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

laurent.alfonsi at linaro dot org <laurent.alfonsi at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #8 from laurent.alfonsi at linaro dot org <laurent.alfonsi at linaro dot org> ---
(In reply to Andrew Pinski from comment #7)
> 
> The uninitialized memory dealing with the stack unwinding is recorded as PR
> 107678 and a patch was sent here:
> https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607668.html (maybe
> that will fix the issue recorded here too).

Introducing fix pointed in PR107678 well fixes the crash I am observing.

However, I m not able to ensure the problem is fully fixed. Because, The
valgrind uninit issues I was observing when building in -static are still
present. As far as i have seen, crash not exposed in -static [chance?].

I proposed to mark it as duplicate of 107678.

Thanks Andrew, Thanks Prathamesh.

*** This bug has been marked as a duplicate of bug 107678 ***

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

end of thread, other threads:[~2022-12-03 21:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-30 20:47 [Bug libstdc++/107940] New: temp_directory_path testcase broken laurent.alfonsi at linaro dot org
2022-11-30 22:00 ` [Bug libstdc++/107940] " redi at gcc dot gnu.org
2022-11-30 22:06 ` pinskia at gcc dot gnu.org
2022-11-30 22:29 ` redi at gcc dot gnu.org
2022-11-30 22:49 ` laurent.alfonsi at linaro dot org
2022-12-01 14:23 ` redi at gcc dot gnu.org
2022-12-01 16:50 ` laurent.alfonsi at linaro dot org
2022-12-01 19:57 ` pinskia at gcc dot gnu.org
2022-12-03 21:24 ` laurent.alfonsi at linaro dot 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).