public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111682] New: valgrind error in tsubst_template_decl
@ 2023-10-03 16:43 dcb314 at hotmail dot com
  2023-10-04 13:28 ` [Bug c++/111682] " ppalka at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dcb314 at hotmail dot com @ 2023-10-03 16:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111682
           Summary: valgrind error in tsubst_template_decl
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Recent gcc trunk, built with valgrind, when given this C++ source code
from the clang testsuite:

template<typename T> struct A {
  template<typename U> struct B;
  template<typename U> struct B<U*>;
};
template<typename T> template<typename U> struct A<T>::B<U*> {};
template struct A<int>;
A<int>::B<int*> b;


template<typename T> struct B {
  template<typename U> static const int var1;
  template<typename U> static const int var1<U*>;

  template<typename U> static const int var2;
};
template<typename T> template<typename U> const int B<T>::var1<U*> = 1;
template<typename T> template<typename U> const int B<T>::var2<U*> = 1;
template struct B<int>;
int b_test1[B<int>::var1<int*>];
int b_test2[B<int>::var2<int*>];


does this:

$ ~/gcc/results.20230927.valgrind/bin/gcc -c -w
./SemaTemplate/instantiate-partial-spec.cpp
==33844== Invalid read of size 2
==33844==    at 0x8CCA6B: tsubst_template_decl(tree_node*, tree_node*, int,
tree_node*, tree_node*) (pt.cc:14684)
==33844==    by 0x8B4469: tsubst_decl(tree_node*, tree_node*, int, bool)
(pt.cc:14933)
==33844==    by 0x8CE78B: most_specialized_partial_spec(tree_node*, int, bool)
(pt.cc:26255)

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

* [Bug c++/111682] valgrind error in tsubst_template_decl
  2023-10-03 16:43 [Bug c++/111682] New: valgrind error in tsubst_template_decl dcb314 at hotmail dot com
@ 2023-10-04 13:28 ` ppalka at gcc dot gnu.org
  2024-01-10 10:26 ` [Bug c++/111682] [14 regression] " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-10-04 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-10-04
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
   Target Milestone|---                         |14.0
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Likely started with r14-3160-gca2676654736e6, before which we rejected the
testcase.

With --enable-checking GCC trunk ICEs on the testcase for me:

<stdin>:16:56: internal compiler error: tree check: expected var_decl or
function_decl or field_decl or type_decl or concept_decl or template_decl, have
ggc_freed in tsubst_template_decl, at cp/pt.cc:14686

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

* [Bug c++/111682] [14 regression] valgrind error in tsubst_template_decl
  2023-10-03 16:43 [Bug c++/111682] New: valgrind error in tsubst_template_decl dcb314 at hotmail dot com
  2023-10-04 13:28 ` [Bug c++/111682] " ppalka at gcc dot gnu.org
@ 2024-01-10 10:26 ` rguenth at gcc dot gnu.org
  2024-02-16 17:45 ` cvs-commit at gcc dot gnu.org
  2024-02-16 17:46 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-10 10:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
            Version|unknown                     |14.0

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

* [Bug c++/111682] [14 regression] valgrind error in tsubst_template_decl
  2023-10-03 16:43 [Bug c++/111682] New: valgrind error in tsubst_template_decl dcb314 at hotmail dot com
  2023-10-04 13:28 ` [Bug c++/111682] " ppalka at gcc dot gnu.org
  2024-01-10 10:26 ` [Bug c++/111682] [14 regression] " rguenth at gcc dot gnu.org
@ 2024-02-16 17:45 ` cvs-commit at gcc dot gnu.org
  2024-02-16 17:46 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-16 17:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:c95dc611a6203f0564722975acff4ad866b9c45e

commit r14-9035-gc95dc611a6203f0564722975acff4ad866b9c45e
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Feb 16 12:44:27 2024 -0500

    c++: add fixed testcase [PR111682]

    Fixed by the PR113612 fix r14-8960-g19ac327de421fe.

            PR c++/111682

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1y/var-templ86.C: New test.

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

* [Bug c++/111682] [14 regression] valgrind error in tsubst_template_decl
  2023-10-03 16:43 [Bug c++/111682] New: valgrind error in tsubst_template_decl dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2024-02-16 17:45 ` cvs-commit at gcc dot gnu.org
@ 2024-02-16 17:46 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-02-16 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=113612
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Incidentally fixed.

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

end of thread, other threads:[~2024-02-16 17:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-03 16:43 [Bug c++/111682] New: valgrind error in tsubst_template_decl dcb314 at hotmail dot com
2023-10-04 13:28 ` [Bug c++/111682] " ppalka at gcc dot gnu.org
2024-01-10 10:26 ` [Bug c++/111682] [14 regression] " rguenth at gcc dot gnu.org
2024-02-16 17:45 ` cvs-commit at gcc dot gnu.org
2024-02-16 17:46 ` ppalka 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).