public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug build/29634] New: tst-realloc.c:134:12: error: pointer 'p' used after 'realloc'
@ 2022-09-28 18:40 danglin at gcc dot gnu.org
  2022-09-29  9:42 ` [Bug build/29634] " schwab@linux-m68k.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: danglin at gcc dot gnu.org @ 2022-09-28 18:40 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 29634
           Summary: tst-realloc.c:134:12: error: pointer 'p' used after
                    'realloc'
           Product: glibc
           Version: 2.35
            Status: NEW
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: danglin at gcc dot gnu.org
                CC: carlos at redhat dot com
  Target Milestone: ---
              Host: hppa*-*-linux*
            Target: hppa*-*-linux*
             Build: hppa*-*-linux*

gcc tst-realloc.c -c -std=gnu11 -fgnu89-inline  -g -O2 -Wall -Wwrite-strings
-Wu
ndef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector
-fno-com
mon -Wstrict-prototypes -Wold-style-definition -fmath-errno    -fno-pie
-I../include -I/home/dave/gnu/glibc/objdir/malloc 
-I/home/dave/gnu/glibc/objdir
  -I../sysdeps/unix/sysv/linux/hppa  -I../sysdeps/hppa/nptl 
-I../sysdeps/unix/s
ysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl 
-I../sysdeps/
pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv 
-I../
sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/hppa/hppa1.1 
-I../sysdeps/wordsi
ze-32  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754/dbl-64 
-I../sysdeps/hp
pa/fpu  -I../sysdeps/hppa  -I../sysdeps/ieee754  -I../sysdeps/generic  -I..
-I..
/libio -I. -nostdinc -isystem /usr/lib/gcc/hppa-linux-gnu/12/include -isystem
/u
sr/include -D_LIBC_REENTRANT -include
/home/dave/gnu/glibc/objdir/libc-modules.h
 -DMODULE_NAME=testsuite -include ../include/libc-symbols.h      
-DTOP_NAMESPAC
E=glibc -DTEST_NO_MALLOPT -o /home/dave/gnu/glibc/objdir/malloc/tst-realloc.o
-M
D -MP -MF /home/dave/gnu/glibc/objdir/malloc/tst-realloc.o.dt -MT
/home/dave/gnu
/glibc/objdir/malloc/tst-realloc.o
In function 'do_test',
    inlined from 'legacy_test_function' at ../test-skeleton.c:55:10:
tst-realloc.c:134:12: error: pointer 'p' used after 'realloc'
[-Werror=use-after-free]
  134 |       if (c[i] != 0xff)
      |           ~^~~
tst-realloc.c:124:7: note: call to 'realloc' here
  124 |   c = realloc (p, -1);
      |       ^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [../o-iterator.mk:9:
/home/dave/gnu/glibc/objdir/malloc/tst-realloc.o] Error 1

dave@atlas:~/gnu/glibc/objdir$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/hppa-linux-gnu/12/lto-wrapper
Target: hppa-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-3'
--with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs
--enable-languages=c,ada,c++,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-12
--program-prefix=hppa-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-libssp --disable-libitm
--disable-libsanitizer --disable-libquadmath --disable-libquadmath-support
--enable-plugin --with-system-zlib --enable-libphobos-checking=release
--with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch
--disable-werror --disable-libstdcxx-pch --enable-checking=release
--build=hppa-linux-gnu --host=hppa-linux-gnu --target=hppa-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Debian 12.2.0-3)

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

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

* [Bug build/29634] tst-realloc.c:134:12: error: pointer 'p' used after 'realloc'
  2022-09-28 18:40 [Bug build/29634] New: tst-realloc.c:134:12: error: pointer 'p' used after 'realloc' danglin at gcc dot gnu.org
@ 2022-09-29  9:42 ` schwab@linux-m68k.org
  2022-09-29 13:07 ` dave.anglin at bell dot net
  2024-01-11  9:33 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2022-09-29  9:42 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
It's a gcc bug: realloc(, -1) does not succeed and p remains valid.

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

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

* [Bug build/29634] tst-realloc.c:134:12: error: pointer 'p' used after 'realloc'
  2022-09-28 18:40 [Bug build/29634] New: tst-realloc.c:134:12: error: pointer 'p' used after 'realloc' danglin at gcc dot gnu.org
  2022-09-29  9:42 ` [Bug build/29634] " schwab@linux-m68k.org
@ 2022-09-29 13:07 ` dave.anglin at bell dot net
  2024-01-11  9:33 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: dave.anglin at bell dot net @ 2022-09-29 13:07 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #2 from dave.anglin at bell dot net ---
On 2022-09-29 5:42 a.m., schwab@linux-m68k.org wrote:
> It's a gcc bug: realloc(, -1) does not succeed and p remains valid.
Test is revised on trunk.

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

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

* [Bug build/29634] tst-realloc.c:134:12: error: pointer 'p' used after 'realloc'
  2022-09-28 18:40 [Bug build/29634] New: tst-realloc.c:134:12: error: pointer 'p' used after 'realloc' danglin at gcc dot gnu.org
  2022-09-29  9:42 ` [Bug build/29634] " schwab@linux-m68k.org
  2022-09-29 13:07 ` dave.anglin at bell dot net
@ 2024-01-11  9:33 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2024-01-11  9:33 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
                 CC|                            |fweimer at redhat dot com
             Status|NEW                         |RESOLVED

--- Comment #3 from Florian Weimer <fweimer at redhat dot com> ---
Fixed per comment 2.

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

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

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

end of thread, other threads:[~2024-01-11  9:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 18:40 [Bug build/29634] New: tst-realloc.c:134:12: error: pointer 'p' used after 'realloc' danglin at gcc dot gnu.org
2022-09-29  9:42 ` [Bug build/29634] " schwab@linux-m68k.org
2022-09-29 13:07 ` dave.anglin at bell dot net
2024-01-11  9:33 ` fweimer at redhat dot com

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