This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] remove broken and redundant diagnostic in i386_pe_section_type_flags

From: Trevor Saunders <>


While fixing up the hash_table patch's bustedness here I noticed the code
doesn't make any sense.  What it inserts into the hash table will never match
what we try and look up in it.  If you want to use hash_table or htab as a map
you need to deal with the keys yourself, it doesn't do it for you.

varasm.c is the only caller of this target hook, and it correctly uses a
htab to check if the flags returned by the hook are the same as the
flags it has for the section, and emit an error if not.  Therefore if we fixed
this machinary it would only ever emit redundant errors, so it would seem to
make sense to get rid of it.

 I don't have a setup to test windows targets at hand, but I checked I can
buildd a compiler targeting x86_64-cygwin with this patch.  Ok if someone can
really test it and it passes?



	* config/i386/winnt.c (i386_pe_section_type_flags): Remove
	redundant diagnostic machinary.

diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index 56cd1b2..8a5d982 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -469,19 +469,12 @@ i386_pe_reloc_rw_mask (void)
 unsigned int
 i386_pe_section_type_flags (tree decl, const char *name, int reloc)
-  static hash_table<pointer_hash<unsigned int> > *htab = NULL;
   unsigned int flags;
-  unsigned int **slot;
   /* Ignore RELOC, if we are allowed to put relocated
      const data into read-only section.  */
   if (!flag_writable_rel_rdata)
     reloc = 0;
-  /* The names we put in the hashtable will always be the unique
-     versions given to us by the stringtable, so we can just use
-     their addresses as the keys.  */
-  if (!htab)
-    htab = new hash_table<pointer_hash<unsigned int> > (31);
   if (decl && TREE_CODE (decl) == FUNCTION_DECL)
     flags = SECTION_CODE;
@@ -499,19 +492,6 @@ i386_pe_section_type_flags (tree decl, const char *name, int reloc)
   if (decl && DECL_P (decl) && DECL_ONE_ONLY (decl))
     flags |= SECTION_LINKONCE;
-  /* See if we already have an entry for this section.  */
-  slot = htab->find_slot ((unsigned int *)name, INSERT);
-  if (!*slot)
-    {
-      *slot = (unsigned int *) xmalloc (sizeof (unsigned int));
-      **slot = flags;
-    }
-  else
-    {
-      if (decl && **slot != flags)
-	error ("%q+D causes a section type conflict", decl);
-    }
   return flags;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]