public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/102718] New: gtype-desc.c function redefinition error for gt_ggc_xxx (int_hash<unsigned int, 0, 4294967295>&)
Date: Tue, 12 Oct 2021 20:44:12 +0000	[thread overview]
Message-ID: <bug-102718-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 102718
           Summary: gtype-desc.c function redefinition error for
                    gt_ggc_xxx (int_hash<unsigned int, 0, 4294967295>&)
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

This is to make a record of a bug in GCC's garbage collection machinery.  With
the following patch I get the errors below.  gtype-desc.c is a generated file
and the errors are due to the gengtype tool generating two definitions of the
gt_ggc_xxx functions, one for each specialization of the hash_map.  It seems
that it's not possible to have two hash_maps with keys of distinct types but
the same element type.

diff --git a/gcc/diagnostic-spec.c b/gcc/diagnostic-spec.c
index 85ffb725c02..dc98696132a 100644
--- a/gcc/diagnostic-spec.c
+++ b/gcc/diagnostic-spec.c
@@ -108,6 +108,7 @@ nowarn_spec_t::nowarn_spec_t (opt_code opt)
 /* A mapping from a 'location_t' to the warning spec set for it.  */

 GTY(()) xint_hash_map_t *nowarn_map;
+extern GTY(()) int_hash_map_t *nowarn_map_2;

 /* Return the no-warning disposition for location LOC and option OPT
    or for all/any otions by default.  */
diff --git a/gcc/diagnostic-spec.h b/gcc/diagnostic-spec.h
index 9b3aaaa3ce6..b1fb304c2f3 100644
--- a/gcc/diagnostic-spec.h
+++ b/gcc/diagnostic-spec.h
@@ -136,4 +136,8 @@ typedef hash_map<xint_hash_t, nowarn_spec_t>
xint_hash_map_t;
 /* A mapping from a 'location_t' to the warning spec set for it.  */
 extern GTY(()) xint_hash_map_t *nowarn_map;

+typedef int_hash <unsigned, 0, UINT_MAX> int_hash_t;
+typedef hash_map<int_hash_t, nowarn_spec_t> int_hash_map_t;
+extern GTY(()) int_hash_map_t *nowarn_map_2;
+
 #endif // DIAGNOSTIC_SPEC_H_INCLUDED


synchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual
-Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common 
-DHAVE_CONFIG_H -I. -I. -I/src/gcc/master/gcc -I/src/gcc/master/gcc/.
-I/src/gcc/master/gcc/../include -I/src/gcc/master/gcc/../libcpp/include
-I/src/gcc/master/gcc/../libcody  -I/src/gcc/master/gcc/../libdecnumber
-I/src/gcc/master/gcc/../libdecnumber/bid -I../libdecnumber
-I/src/gcc/master/gcc/../libbacktrace   -o gtype-desc.o -MT gtype-desc.o -MMD
-MP -MF ./.deps/gtype-desc.TPo gtype-desc.c
gtype-desc.c:3037:1: error: redefinition of ‘void gt_ggc_mx(nowarn_spec_t&)’
 gt_ggc_mx (struct nowarn_spec_t& x_r ATTRIBUTE_UNUSED)
 ^~~~~~~~~
gtype-desc.c:3014:1: note: ‘void gt_ggc_mx(nowarn_spec_t&)’ previously defined
here
 gt_ggc_mx (struct nowarn_spec_t& x_r ATTRIBUTE_UNUSED)
 ^~~~~~~~~
gtype-desc.c:3043:1: error: redefinition of ‘void gt_ggc_mx(int_hash<unsigned
int, 0, 4294967295>&)’
 gt_ggc_mx (int_hash<unsigned,0,UINT_MAX>& x_r ATTRIBUTE_UNUSED)
 ^~~~~~~~~
gtype-desc.c:3020:1: note: ‘void gt_ggc_mx(int_hash<unsigned int, 0,
4294967295>&)’ previously defined here
 gt_ggc_mx (int_hash<location_t,0,UINT_MAX>& x_r ATTRIBUTE_UNUSED)
 ^~~~~~~~~
gtype-desc.c:6999:1: error: redefinition of ‘void gt_pch_nx(nowarn_spec_t&)’
 gt_pch_nx (struct nowarn_spec_t& x_r ATTRIBUTE_UNUSED)
 ^~~~~~~~~
gtype-desc.c:6976:1: note: ‘void gt_pch_nx(nowarn_spec_t&)’ previously defined
here
 gt_pch_nx (struct nowarn_spec_t& x_r ATTRIBUTE_UNUSED)
 ^~~~~~~~~
gtype-desc.c:7005:1: error: redefinition of ‘void gt_pch_nx(int_hash<unsigned
int, 0, 4294967295>&)’
 gt_pch_nx (int_hash<unsigned,0,UINT_MAX>& x_r ATTRIBUTE_UNUSED)
 ^~~~~~~~~
gtype-desc.c:6982:1: note: ‘void gt_pch_nx(int_hash<unsigned int, 0,
4294967295>&)’ previously defined here
 gt_pch_nx (int_hash<location_t,0,UINT_MAX>& x_r ATTRIBUTE_UNUSED)
 ^~~~~~~~~
gtype-desc.c:11395:1: error: redefinition of ‘void gt_pch_nx(nowarn_spec_t*,
gt_pointer_operator, void*)’
 gt_pch_nx (struct nowarn_spec_t* x ATTRIBUTE_UNUSED,
 ^~~~~~~~~
gtype-desc.c:11369:1: note: ‘void gt_pch_nx(nowarn_spec_t*,
gt_pointer_operator, void*)’ previously defined here
 gt_pch_nx (struct nowarn_spec_t* x ATTRIBUTE_UNUSED,
 ^~~~~~~~~
gtype-desc.c:11402:1: error: redefinition of ‘void gt_pch_nx(int_hash<unsigned
int, 0, 4294967295>*, gt_pointer_operator, void*)’
 gt_pch_nx (int_hash<unsigned,0,UINT_MAX>* x ATTRIBUTE_UNUSED,
 ^~~~~~~~~
gtype-desc.c:11376:1: note: ‘void gt_pch_nx(int_hash<unsigned int, 0,
4294967295>*, gt_pointer_operator, void*)’ previously defined here
 gt_pch_nx (int_hash<location_t,0,UINT_MAX>* x ATTRIBUTE_UNUSED,
 ^~~~~~~~~

             reply	other threads:[~2021-10-12 20:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 20:44 msebor at gcc dot gnu.org [this message]
2021-10-13  7:34 ` [Bug other/102718] " rguenth at gcc dot gnu.org
2021-11-24 21:35 ` tschwinge at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-102718-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).