re PR target/25254 (ICE with -mcmodel=medium -mlarge-data-threshold=1)

PR target/25254
	PR target/24188
	* config/i386/i386.c (x86_64_elf_select_section): If DECL is not
	DECL_P, call get_section rather than get_named_section.  Supply
	section flags to it.

	* gcc.target/i386/pr25254.c: New test.
	* gfortran.dg/PR24188.f: New test.

From-SVN: r108506
This commit is contained in:
Jakub Jelinek 2005-12-14 12:00:50 +01:00 committed by Jakub Jelinek
parent 025509856a
commit 3b10d28608
5 changed files with 44 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2005-12-14 Jakub Jelinek <jakub@redhat.com>
PR target/25254
PR target/24188
* config/i386/i386.c (x86_64_elf_select_section): If DECL is not
DECL_P, call get_section rather than get_named_section. Supply
section flags to it.
2005-12-14 Ben Elliston <bje@au.ibm.com>
* c-common.c (c_common_truthvalue_conversion): Generalise warning

View File

@ -1703,6 +1703,7 @@ x86_64_elf_select_section (tree decl, int reloc,
&& ix86_in_large_data_p (decl))
{
const char *sname = NULL;
unsigned int flags = SECTION_WRITE;
switch (categorize_decl_for_section (decl, reloc, flag_pic))
{
case SECCAT_DATA:
@ -1722,12 +1723,14 @@ x86_64_elf_select_section (tree decl, int reloc,
break;
case SECCAT_BSS:
sname = ".lbss";
flags |= SECTION_BSS;
break;
case SECCAT_RODATA:
case SECCAT_RODATA_MERGE_STR:
case SECCAT_RODATA_MERGE_STR_INIT:
case SECCAT_RODATA_MERGE_CONST:
sname = ".lrodata";
flags = 0;
break;
case SECCAT_SRODATA:
case SECCAT_SDATA:
@ -1741,7 +1744,14 @@ x86_64_elf_select_section (tree decl, int reloc,
break;
}
if (sname)
return get_named_section (decl, sname, reloc);
{
/* We might get called with string constants, but get_named_section
doesn't like them as they are not DECLs. Also, we need to set
flags in that case. */
if (!DECL_P (decl))
return get_section (sname, flags, NULL);
return get_named_section (decl, sname, reloc);
}
}
return default_elf_select_section (decl, reloc, align);
}

View File

@ -1,3 +1,10 @@
2005-12-14 Jakub Jelinek <jakub@redhat.com>
PR target/25254
PR target/24188
* gcc.target/i386/pr25254.c: New test.
* gfortran.dg/PR24188.f: New test.
2005-12-14 David Billinghurst (David.Billinghurst@riotinto.com)
* lib/fortran-torture.exp: Catch remaining uses of

View File

@ -0,0 +1,11 @@
/* PR target/25254 */
/* { dg-do compile { target lp64 } } */
/* { dg-options "-mcmodel=medium -mlarge-data-threshold=1" } */
const struct { int i; int j; } c = { 2, 6 };
const char *
foo (void)
{
return "OK";
}

View File

@ -0,0 +1,7 @@
C PR target/24188
C { dg-do compile }
C { dg-options "-O2" }
C { dg-options "-O2 -mcmodel=medium" { target { x86_64-*-* && lp64 } } }
C { dg-options "-O2 -mcmodel=medium" { target { i?86-*-* && lp64 } } }
WRITE(6,*) ''
END