This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PR traget/24188 (-mcmodel=medium ICE)
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 4 Nov 2005 13:11:04 +0100
- Subject: PR traget/24188 (-mcmodel=medium ICE)
Hi,
following fortran program causes ICE with -mcmodel=medium
SUBROUTINE FOO
WRITE(6,*) ''
END
The problem is twofold. Firstly ix86_in_large_data_p conclude that the string should
go into memory. This is result of code that think that size of 0 is for incomplette
types so they must be assumed to be infinite.
This is obviously wrong for STRING_CST, but I think it is wrong for some other
cases too, I am just unsure how to differentiate them. However empty string
might be important enought special case ;)
Second problem is that x86_64_elf_select_section leads to named_section and pass there
STRING_CST as a DECL argument. named_section however asserts that DECL is decl
and aborts. I think it is safe to pass here just NULL even if it is not looking
for decl to work out the flags.
Does this seem to make sense?
Bootstrapped/regtested x86_64-linux
Honza
2005-11-03 Jan Hubicka <jh@suse.cz>
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;
}