public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/103157] New: 'gengtype': 'typedef' causing infinite-recursion code to be generated
@ 2021-11-09 11:58 tschwinge at gcc dot gnu.org
  2021-11-09 12:01 ` [Bug other/103157] " pinskia at gcc dot gnu.org
  2021-11-09 12:21 ` cvs-commit at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2021-11-09 11:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103157
           Summary: 'gengtype': 'typedef' causing infinite-recursion code
                    to be generated
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tschwinge at gcc dot gnu.org
                CC: rguenth at gcc dot gnu.org
  Target Milestone: ---

As we found in the course of PR101204, there are ways that certain use of
'typedef' with GTY-marked types causes 'gengtype' to generate
infinite-recursion code.

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

* [Bug other/103157] 'gengtype': 'typedef' causing infinite-recursion code to be generated
  2021-11-09 11:58 [Bug other/103157] New: 'gengtype': 'typedef' causing infinite-recursion code to be generated tschwinge at gcc dot gnu.org
@ 2021-11-09 12:01 ` pinskia at gcc dot gnu.org
  2021-11-09 12:21 ` cvs-commit at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-09 12:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
There is a dup of this bug already

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

* [Bug other/103157] 'gengtype': 'typedef' causing infinite-recursion code to be generated
  2021-11-09 11:58 [Bug other/103157] New: 'gengtype': 'typedef' causing infinite-recursion code to be generated tschwinge at gcc dot gnu.org
  2021-11-09 12:01 ` [Bug other/103157] " pinskia at gcc dot gnu.org
@ 2021-11-09 12:21 ` cvs-commit at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-09 12:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Thomas Schwinge <tschwinge@gcc.gnu.org>:

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

commit r12-5047-gc71cb26a9e841888f52e4bfcaad94c8f8ecb4fdb
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Tue Nov 9 10:55:15 2021 +0100

    Get rid of infinite recursion for 'typedef' used with GTY-marked
'gcc/diagnostic-spec.h:nowarn_map' [PR101204, PR103157]

    Reproduced with clang version 10.0.0-4ubuntu1:

        gtype-desc.c:11333:1: warning: all paths through this function will
call itself [-Winfinite-recursion]

    ... as well as some GCC's '-O2 -fdump-tree-optimized':

        void gt_pch_nx(int_hash<unsigned int, 0u, 4294967295u>*,
gt_pointer_operator, void*) ([...])
        {
          <bb 2>:

          <bb 3>:
          goto <bb 3>;

        }

    That three-arguments 'gt_pch_nx' function as well as two one-argument
    'gt_ggc_mx', 'gt_pch_nx' functions now turn empty:

        [...]
         void
        -gt_ggc_mx (int_hash<location_t,0,UINT_MAX>& x_r ATTRIBUTE_UNUSED)
        +gt_ggc_mx (struct xint_hash_t& x_r ATTRIBUTE_UNUSED)
         {
        -  int_hash<location_t,0,UINT_MAX> * ATTRIBUTE_UNUSED x = &x_r;
        -  gt_ggc_mx (&((*x)));
        +  struct xint_hash_t * ATTRIBUTE_UNUSED x = &x_r;
         }
        [...]
         void
        -gt_pch_nx (int_hash<location_t,0,UINT_MAX>& x_r ATTRIBUTE_UNUSED)
        +gt_pch_nx (struct xint_hash_t& x_r ATTRIBUTE_UNUSED)
         {
        -  int_hash<location_t,0,UINT_MAX> * ATTRIBUTE_UNUSED x = &x_r;
        -  gt_pch_nx (&((*x)));
        +  struct xint_hash_t * ATTRIBUTE_UNUSED x = &x_r;
         }
        [...]
         void
        -gt_pch_nx (int_hash<location_t,0,UINT_MAX>* x ATTRIBUTE_UNUSED,
        +gt_pch_nx (struct xint_hash_t* x ATTRIBUTE_UNUSED,
                ATTRIBUTE_UNUSED gt_pointer_operator op,
                ATTRIBUTE_UNUSED void *cookie)
         {
        -    gt_pch_nx (&((*x)), op, cookie);
         }
        [...]

            gcc/
            PR middle-end/101204
            PR other/103157
            * diagnostic-spec.h (typedef xint_hash_t): Turn into...
            (struct xint_hash_t): ... this.
            * doc/gty.texi: Update.

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

end of thread, other threads:[~2021-11-09 12:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09 11:58 [Bug other/103157] New: 'gengtype': 'typedef' causing infinite-recursion code to be generated tschwinge at gcc dot gnu.org
2021-11-09 12:01 ` [Bug other/103157] " pinskia at gcc dot gnu.org
2021-11-09 12:21 ` cvs-commit 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).