------- Comment #6 from hubicka at ucw dot cz  2005-11-03 20:52 -------
Subject: Re:  [4.1 Regression] WRITE(6,*) causes an ICE with -mcmodel=medium

OK, I think what is going on.
For some reason the code deciding whether data should be small or big
considers everything zero sized as unfinished potentially big.  Not
quite sure why.  This makes it to exceptionally consider zero sized
string constants small and to actually avoid named_section from
crashing...

I am not quite certain by both chunks, but it is best I can think of
today...

SUBROUTINE FOO
   WRITE(6,*) ''
END
2005-11-03  Jan Hubicka  <[EMAIL PROTECTED]>
        PR target/24188
        * i386.c (x86_64_elf_select_section): Handle STRING_CST without crash.
        (ix86_in_large_data_p): Zero sized STRING_CSTs are complette.
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c      (revision 106422)
+++ gcc/config/i386/i386.c      (working copy)
@@ -1741,6 +1741,10 @@ x86_64_elf_select_section (tree decl, in
        }
       if (sname)
        {
+         /* We might get called with string constants, but named_section
+            don't like them as they are not DECLs.  */
+         if (!DECL_P (decl))
+           decl = NULL;
           named_section (decl, sname, reloc);
          return;
        }
@@ -17996,7 +18000,9 @@ ix86_in_large_data_p (tree exp)

       /* If this is an incomplete type with size 0, then we can't put it
         in data because it might be too big when completed.  */
-      if (!size || size > ix86_section_threshold)
+      if ((!size && TREE_CODE (exp) != STRING_CST)
+         || size < 0
+         || size > ix86_section_threshold)
        return true;
     }



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24188

Reply via email to