Bug 91448 - FAIL: g++.dg/opt/flifetime-dse2.C -std=gnu++98 execution test
Summary: FAIL: g++.dg/opt/flifetime-dse2.C -std=gnu++98 execution test
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2019-08-14 20:28 UTC by John David Anglin
Modified: 2019-08-21 22:36 UTC (History)
2 users (show)

See Also:
Host: hppa*-*-hpux11.11
Target: hppa*-*-hpux11.11
Build: hppa*-*-hpux11.11
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2019-08-14 20:28:01 UTC
spawn /test/gnu/gcc/objdir/gcc/testsuite/g++/../../xg++ -B/test/gnu/gcc/objdir/g
cc/testsuite/g++/../../ /test/gnu/gcc/gcc/gcc/testsuite/g++.dg/opt/flifetime-dse
2.C -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers -fdiagnostics
-color=never -nostdinc++ -I/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/libstdc++-
v3/include/hppa2.0w-hp-hpux11.11 -I/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/li
bstdc++-v3/include -I/test/gnu/gcc/gcc/libstdc++-v3/libsupc++ -I/test/gnu/gcc/gc
c/libstdc++-v3/include/backward -I/test/gnu/gcc/gcc/libstdc++-v3/testsuite/util
-fmessage-length=0 -std=gnu++98 -O3 -flifetime-dse -L/test/gnu/gcc/objdir/hppa2.
0w-hp-hpux11.11/./libstdc++-v3/src/.libs -B/test/gnu/gcc/objdir/hppa2.0w-hp-hpux
11.11/./libstdc++-v3/src/.libs -L/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./li
bstdc++-v3/src/.libs -lm -o ./flifetime-dse2.exe
PASS: g++.dg/opt/flifetime-dse2.C  -std=gnu++98 (test for excess errors)
Setting LD_LIBRARY_PATH to .:/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libstd
c++-v3/src/.libs:/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libstdc++-v3/src/.
libs:/test/gnu/gcc/objdir/gcc:.:/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./lib
stdc++-v3/src/.libs:/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libstdc++-v3/sr
c/.libs:/test/gnu/gcc/objdir/gcc
spawn [open ...]
FAIL: g++.dg/opt/flifetime-dse2.C  -std=gnu++98 execution test

Test is completely optimized leaving only call to abort().

        .SPACE $TEXT$
        .NSUBSPA $CODE$
        .align 4
        .EXPORT main,ENTRY,PRIV_LEV=3,RTNVAL=GR
L$FB7:
main:
        .PROC
        .CALLINFO FRAME=64,CALLS,SAVE_RP
        .ENTRY
        stw %r2,-20(%r30)
        ldo 64(%r30),%r30
L$CFI0:
        .CALL
        bl abort,%r2
        nop
        nop
        .EXIT
        .PROCEND
L$FE7:
        .IMPORT abort,CODE

Similar fails:
FAIL: g++.dg/opt/flifetime-dse2.C  -std=gnu++14 execution test
FAIL: g++.dg/opt/flifetime-dse2.C  -std=gnu++17 execution test
FAIL: g++.dg/opt/flifetime-dse4.C  -std=gnu++98 execution test
FAIL: g++.dg/opt/flifetime-dse4.C  -std=gnu++14 execution test
FAIL: g++.dg/opt/flifetime-dse4.C  -std=gnu++17 execution test
Comment 1 John David Anglin 2019-08-14 20:49:31 UTC
I also see the following fails:

FAIL: g++.dg/warn/Warray-bounds-4.C  -std=gnu++98  (test for warnings, line 25)
FAIL: g++.dg/warn/Warray-bounds-4.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/warn/Warray-bounds-4.C  -std=gnu++14  (test for warnings, line 25)
FAIL: g++.dg/warn/Warray-bounds-4.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/warn/Warray-bounds-4.C  -std=gnu++17  (test for warnings, line 25)
FAIL: g++.dg/warn/Warray-bounds-4.C  -std=gnu++17 (test for excess errors)

spawn /test/gnu/gcc/objdir/gcc/testsuite/g++/../../xg++ -B/test/gnu/gcc/objdir/g
cc/testsuite/g++/../../ /test/gnu/gcc/gcc/gcc/testsuite/g++.dg/warn/Warray-bounds-4.C -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers -fdiagnostics-color=never -nostdinc++ -I/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/libstdc++-v3/include/hppa2.0w-hp-hpux11.11 -I/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/libstdc++-v3/include -I/test/gnu/gcc/gcc/libstdc++-v3/libsupc++ -I/test/gnu/gcc/gcc/libstdc++-v3/include/backward -I/test/gnu/gcc/gcc/libstdc++-v3/testsuite/util -fmessage-length=0 -std=gnu++98 -O2 -Warray-bounds -S -o Warray-bounds-4.s
In constructor 'FixedString<size>::FixedString() [with long unsigned int size = 0]',
    inlined from 'int main()' at /test/gnu/gcc/gcc/gcc/testsuite/g++.dg/warn/Warray-bounds-4.C:32:24:
/test/gnu/gcc/gcc/gcc/testsuite/g++.dg/warn/Warray-bounds-4.C:25:19: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
output is:
In constructor 'FixedString<size>::FixedString() [with long unsigned int size = 0]',
    inlined from 'int main()' at /test/gnu/gcc/gcc/gcc/testsuite/g++.dg/warn/Warray-bounds-4.C:32:24:
/test/gnu/gcc/gcc/gcc/testsuite/g++.dg/warn/Warray-bounds-4.C:25:19: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]

FAIL: g++.dg/warn/Warray-bounds-4.C  -std=gnu++98  (test for warnings, line 25)
FAIL: g++.dg/warn/Warray-bounds-4.C  -std=gnu++98 (test for excess errors)
Excess errors:
/test/gnu/gcc/gcc/gcc/testsuite/g++.dg/warn/Warray-bounds-4.C:25:19: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]

It looks like these fails may be related to fails on darwin:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91006
Comment 2 Martin Sebor 2019-08-14 21:28:48 UTC
I don't know about the flifetime-dse2.C test but the Warray-bounds-4.C warning is the result of a recent enhancement to the strlen optimization, either r274486 or r273783.  On the hppa2.0w-hp-hpux11.11 target the warning newly added in r273783 sees the following code:

  main ()
  {
    const struct FixedString empty;

    <bb 2> [local count: 1073741824]:
    MEM[(int (*) () * *)&empty] = &MEM <int (*) ()[8]> [(void *)&_ZTV11FixedStringILm0EE + 8B];
    MEM[(char *)&empty + 4B] = 0;
    print_length (&empty.D.2009);   <<<
    empty ={v} {CLOBBER};
    empty ={v} {CLOBBER};
    return 0;
  }

and diagnoses the invalid store at <<< before VRP gets to it and issues -Warray-bounds.  On other targets like sparc-solaris2.11, the strlen pass sees the following code:

main ()
{
  const struct FixedString empty;

  <bb 2> [local count: 1073741824]:
  MEM[(struct FixedString *)&empty] ={v} {CLOBBER};
  MEM[(struct FixedString *)&empty].D.2008._vptr.String = &MEM <int (*) ()[8]> [(void *)&_ZTV11FixedStringILm0EE + 8B];
  MEM[(struct FixedString *)&empty].contents[0] = 0;   <<<
  print_length (&empty.D.2008);
  empty ={v} {CLOBBER};
  empty ={v} {CLOBBER};
  return 0;

}

and it doesn't handle this form of the assignment (it doesn't know how to determine the size of the referenced object).  Ideally, both kinds would be handled and the same warning would be issued.  It means enhancing the object size detection (compute_objsize in builtins.c).
Comment 3 Richard Biener 2019-08-15 07:16:34 UTC
Please open another bug for the excess error case, it looks unrelated and would be qualified differently.
Comment 4 John David Anglin 2019-08-15 14:12:48 UTC
Discussion on excess errors for g++.dg/warn/Warray-bounds-4.C move to Bug 91457:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91457
Comment 5 John David Anglin 2019-08-21 22:36:31 UTC
The flifetime tests fail on both 32 and 64-bit hpux targets.