public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs)
@ 2024-05-17 13:46 sjames at gcc dot gnu.org
  2024-05-17 13:48 ` [Bug middle-end/115137] " sjames at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-05-17 13:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115137
           Summary: [15 regression] Miscompilation of wget (test suite
                    hangs)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

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

I noticed that wget's testsuite was hanging today in `unit-tests`.

```
(gdb) bt
#0  0x0000555555559319 in append_uri_pathel (e=e@entry=0x55555555a09d "",
escaped=escaped@entry=false, dest=dest@entry=0x7fffffffd780, b=0x55555555a090
"somepage.html")
    at ../src/url.c:1509
#1  0x00005555555563e0 in test_append_uri_pathel () at ../src/url.c:2492
#2  all_tests () at /home/sam/git/wget/tests/unit-tests.c:47
#3  main (argc=<optimized out>, argv=<optimized out>) at
/home/sam/git/wget/tests/unit-tests.c:70
```

I'm still reducing it but it hangs with gcc-15 -O2.

```
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/15/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/15
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/15/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/15/python
--enable-languages=c,c++,fortran,rust --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--disable-libunwind-exceptions --enable-checking=yes,extra,rtl
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened
15.0.9999 p, commit bc7d81fe2f725b4043ce8b9ffb11d80032ce3f75'
--with-gcc-major-version-only --enable-libstdcxx-time --enable-lto
--disable-libstdcxx-pch --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-multilib
--with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all
--enable-libgomp --disable-libssp --disable-libada --disable-cet
--disable-systemtap --enable-valgrind-annotations --disable-vtable-verify
--disable-libvtv --with-zstd --with-isl --disable-isl-version-check
--enable-default-pie --enable-host-pie --enable-host-bind-now
--enable-default-ssp --disable-fixincludes --with-build-config=bootstrap-O3
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.0.0 20240516 (experimental)
556e777298dac8574533935000c57335c5232921 (Gentoo Hardened 15.0.9999 p, commit
bc7d81fe2f725b4043ce8b9ffb11d80032ce3f75) 
```

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

* [Bug middle-end/115137] [15 regression] Miscompilation of wget (test suite hangs)
  2024-05-17 13:46 [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs) sjames at gcc dot gnu.org
@ 2024-05-17 13:48 ` sjames at gcc dot gnu.org
  2024-05-17 13:49 ` sjames at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-05-17 13:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
Notable bits:
* -fno-strict-aliasing makes no difference
* -fno-strict-overflow stops the hang
* -fsanitize=address,undefined shows nothing with < GCC 15
* With GCC 15 only, I get

```
$ ./z
url.c:1575:41: runtime error: load of address 0x557b31e7c12e with insufficient
space for an object of type 'const char'
0x557b31e7c12e: note: pointer points here
 74 6d 6c 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00
00 00 00 00 00  00 00
             ^ 
    #0 0x557b31e7b681 in append_uri_pathel /home/sam/git/wget/backup/url.c:1575
    #1 0x557b31e7b94b in test_append_uri_pathel
/home/sam/git/wget/backup/url.c:1667
    #2 0x557b31e7a3a8 in main /home/sam/git/wget/backup/url.c:1679
    #3 0x7f251342df49  (/usr/lib64/libc.so.6+0x25f49)
    #4 0x7f251342e004 in __libc_start_main (/usr/lib64/libc.so.6+0x26004)
    #5 0x557b31e7a400 in _start (/home/sam/git/wget/backup/z+0x4400)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior url.c:1575:41 in 
Aborted (core dumped)
```

But only when building with `-O2 -fsanitize=address,undefined`. -O3 with
ASAN+UBSAN is fine.

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

* [Bug middle-end/115137] [15 regression] Miscompilation of wget (test suite hangs)
  2024-05-17 13:46 [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs) sjames at gcc dot gnu.org
  2024-05-17 13:48 ` [Bug middle-end/115137] " sjames at gcc dot gnu.org
@ 2024-05-17 13:49 ` sjames at gcc dot gnu.org
  2024-05-17 15:53 ` [Bug middle-end/115137] [15 regression] Miscompilation of wget (test suite hangs) since r15-580-gf3e5f4c58591f5 sjames at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-05-17 13:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Sam James <sjames at gcc dot gnu.org> ---
I have a reduction still running but I didn't do much manual analysis other
than doing enough to remove its dependency on other files + remove the need for
LTO (which was originally required).

I haven't yet bisected either.

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

* [Bug middle-end/115137] [15 regression] Miscompilation of wget (test suite hangs) since r15-580-gf3e5f4c58591f5
  2024-05-17 13:46 [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs) sjames at gcc dot gnu.org
  2024-05-17 13:48 ` [Bug middle-end/115137] " sjames at gcc dot gnu.org
  2024-05-17 13:49 ` sjames at gcc dot gnu.org
@ 2024-05-17 15:53 ` sjames at gcc dot gnu.org
  2024-05-17 15:58 ` sjames at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-05-17 15:53 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org
            Summary|[15 regression]             |[15 regression]
                   |Miscompilation of wget      |Miscompilation of wget
                   |(test suite hangs)          |(test suite hangs) since
                   |                            |r15-580-gf3e5f4c58591f5

--- Comment #3 from Sam James <sjames at gcc dot gnu.org> ---
Bisect says r15-580-gf3e5f4c58591f5.

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

* [Bug middle-end/115137] [15 regression] Miscompilation of wget (test suite hangs) since r15-580-gf3e5f4c58591f5
  2024-05-17 13:46 [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs) sjames at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-05-17 15:53 ` [Bug middle-end/115137] [15 regression] Miscompilation of wget (test suite hangs) since r15-580-gf3e5f4c58591f5 sjames at gcc dot gnu.org
@ 2024-05-17 15:58 ` sjames at gcc dot gnu.org
  2024-05-17 17:37 ` sjames at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-05-17 15:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Sam James from comment #3)
> Bisect says r15-580-gf3e5f4c58591f5.

(Still fails on trunk as of r15-634-gb59de4113262f2.)

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

* [Bug middle-end/115137] [15 regression] Miscompilation of wget (test suite hangs) since r15-580-gf3e5f4c58591f5
  2024-05-17 13:46 [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs) sjames at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-05-17 15:58 ` sjames at gcc dot gnu.org
@ 2024-05-17 17:37 ` sjames at gcc dot gnu.org
  2024-05-17 17:48 ` sjames at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-05-17 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Sam James <sjames at gcc dot gnu.org> ---
Reduced further:
```
enum { a } b;
char *c;
int d, e;
static void f(char *g, char *h) {
  char a[1024];
  c = a;
  for (; g < h; g++)
    if (b)
      ++d;
}
int main() { f("somepage.html", "" + e); }
```

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

* [Bug middle-end/115137] [15 regression] Miscompilation of wget (test suite hangs) since r15-580-gf3e5f4c58591f5
  2024-05-17 13:46 [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs) sjames at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-05-17 17:37 ` sjames at gcc dot gnu.org
@ 2024-05-17 17:48 ` sjames at gcc dot gnu.org
  2024-05-18  7:38 ` sjames at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-05-17 17:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Sam James <sjames at gcc dot gnu.org> ---
```
char *c;
int b, d, e;

static void f(char *g, char *h) {
  char a[1024] = {};
  c = a;
  for (; g < h; g++)
    if (b)
      ++d;
}

int main() { f("somepage.html", "" + e); }
```

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

* [Bug middle-end/115137] [15 regression] Miscompilation of wget (test suite hangs) since r15-580-gf3e5f4c58591f5
  2024-05-17 13:46 [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs) sjames at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-05-17 17:48 ` sjames at gcc dot gnu.org
@ 2024-05-18  7:38 ` sjames at gcc dot gnu.org
  2024-05-18  7:43 ` sjames at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-05-18  7:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Sam James from comment #6)
> ```
> char *c;
> int b, d, e;
> 
> static void f(char *g, char *h) {
>   char a[1024] = {};
>   c = a;
>   for (; g < h; g++)
>     if (b)
>       ++d;
> }
> 
> int main() { f("somepage.html", "" + e); }
> ```

I've been looking at this on/off for a while because it didn't feel right. A
friend pointed out that it's UB to compare distinct objects, duh. The original
code looks like this too. I think it's therefore INVALID.

The remaining question is: is -fno-strict-aliasing supposed to disable pointer
provenance analysis as QOI or is it purely for TBAA?

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

* [Bug middle-end/115137] [15 regression] Miscompilation of wget (test suite hangs) since r15-580-gf3e5f4c58591f5
  2024-05-17 13:46 [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs) sjames at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-05-18  7:38 ` sjames at gcc dot gnu.org
@ 2024-05-18  7:43 ` sjames at gcc dot gnu.org
  2024-05-18 13:50 ` sjames at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-05-18  7:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Sam James <sjames at gcc dot gnu.org> ---
The original is:
```
append_uri_pathel (fname_len_check,
    fname_len_check + strlen (fname_len_check), true, &temp_fnres);

[...]

/* Walk the PATHEL string and check how many characters we'll need
     to quote.  */
  quoted = 0;
  for (p = b; p < e; p++)
    if (FILE_CHAR_TEST (*p, mask))
      ++quoted;
```

... so there, b and e do overlap and point to the same object. Let me try
reduce again.

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

* [Bug middle-end/115137] [15 regression] Miscompilation of wget (test suite hangs) since r15-580-gf3e5f4c58591f5
  2024-05-17 13:46 [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs) sjames at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-05-18  7:43 ` sjames at gcc dot gnu.org
@ 2024-05-18 13:50 ` sjames at gcc dot gnu.org
  2024-05-18 13:59 ` [Bug tree-optimization/115137] " pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-05-18 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Sam James <sjames at gcc dot gnu.org> ---
Created attachment 58233
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58233&action=edit
reduced.c

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

* [Bug tree-optimization/115137] [15 regression] Miscompilation of wget (test suite hangs) since r15-580-gf3e5f4c58591f5
  2024-05-17 13:46 [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs) sjames at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2024-05-18 13:50 ` sjames at gcc dot gnu.org
@ 2024-05-18 13:59 ` pinskia at gcc dot gnu.org
  2024-05-21  8:14 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 13:59 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |15.0
          Component|middle-end                  |tree-optimization
   Target Milestone|---                         |15.0

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

* [Bug tree-optimization/115137] [15 regression] Miscompilation of wget (test suite hangs) since r15-580-gf3e5f4c58591f5
  2024-05-17 13:46 [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs) sjames at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2024-05-18 13:59 ` [Bug tree-optimization/115137] " pinskia at gcc dot gnu.org
@ 2024-05-21  8:14 ` rguenth at gcc dot gnu.org
  2024-05-21 10:00 ` cvs-commit at gcc dot gnu.org
  2024-05-21 10:00 ` rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-21  8:14 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-05-21
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine.  Testing patch.

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

* [Bug tree-optimization/115137] [15 regression] Miscompilation of wget (test suite hangs) since r15-580-gf3e5f4c58591f5
  2024-05-17 13:46 [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs) sjames at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2024-05-21  8:14 ` rguenth at gcc dot gnu.org
@ 2024-05-21 10:00 ` cvs-commit at gcc dot gnu.org
  2024-05-21 10:00 ` rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-21 10:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:85f7828679edc3ae7488594145756cd53787650e

commit r15-753-g85f7828679edc3ae7488594145756cd53787650e
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 21 10:12:40 2024 +0200

    tree-optimization/115137 - more ptr-vs-ptr compare fixes

    The following fixes the omission of const-pool included in NONLOCAL.

            PR tree-optimization/115137
            * tree-ssa-structalias.cc (pt_solution_includes_const_pool):
NONLOCAL
            also includes constant pool entries.

            * gcc.dg/torture/pr115137.c: New testcase.

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

* [Bug tree-optimization/115137] [15 regression] Miscompilation of wget (test suite hangs) since r15-580-gf3e5f4c58591f5
  2024-05-17 13:46 [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs) sjames at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2024-05-21 10:00 ` cvs-commit at gcc dot gnu.org
@ 2024-05-21 10:00 ` rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-21 10:00 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2024-05-21 10:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-17 13:46 [Bug middle-end/115137] New: [15 regression] Miscompilation of wget (test suite hangs) sjames at gcc dot gnu.org
2024-05-17 13:48 ` [Bug middle-end/115137] " sjames at gcc dot gnu.org
2024-05-17 13:49 ` sjames at gcc dot gnu.org
2024-05-17 15:53 ` [Bug middle-end/115137] [15 regression] Miscompilation of wget (test suite hangs) since r15-580-gf3e5f4c58591f5 sjames at gcc dot gnu.org
2024-05-17 15:58 ` sjames at gcc dot gnu.org
2024-05-17 17:37 ` sjames at gcc dot gnu.org
2024-05-17 17:48 ` sjames at gcc dot gnu.org
2024-05-18  7:38 ` sjames at gcc dot gnu.org
2024-05-18  7:43 ` sjames at gcc dot gnu.org
2024-05-18 13:50 ` sjames at gcc dot gnu.org
2024-05-18 13:59 ` [Bug tree-optimization/115137] " pinskia at gcc dot gnu.org
2024-05-21  8:14 ` rguenth at gcc dot gnu.org
2024-05-21 10:00 ` cvs-commit at gcc dot gnu.org
2024-05-21 10:00 ` rguenth 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).