* [Patch] Potential fix for PR55033
@ 2012-10-23 16:38 Sebastian Huber
2012-10-24 15:17 ` Alan Modra
2012-10-26 12:35 ` Sebastian Huber
0 siblings, 2 replies; 10+ messages in thread
From: Sebastian Huber @ 2012-10-23 16:38 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 323 bytes --]
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
[-- Attachment #2: 0001-Potential-fix-for-PR55033.patch --]
[-- Type: text/x-patch, Size: 2622 bytes --]
From 7770cb04ee95666e745f96b779edec10560203e6 Mon Sep 17 00:00:00 2001
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date: Tue, 23 Oct 2012 18:06:25 +0200
Subject: [PATCH] Potential fix for PR55033
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55033
This patch fixes my problem, but I am absolutely not sure if this is the
right way.
We have in gcc/varasm.c:
[...]
static bool
decl_readonly_section_1 (enum section_category category)
{
switch (category)
{
case SECCAT_RODATA:
case SECCAT_RODATA_MERGE_STR:
case SECCAT_RODATA_MERGE_STR_INIT:
case SECCAT_RODATA_MERGE_CONST:
case SECCAT_SRODATA:
return true;
default:
return false;
}
}
[...]
section *
default_elf_select_section (tree decl, int reloc,
unsigned HOST_WIDE_INT align)
{
const char *sname;
switch (categorize_decl_for_section (decl, reloc))
{
case SECCAT_TEXT:
/* We're not supposed to be called on FUNCTION_DECLs. */
gcc_unreachable ();
case SECCAT_RODATA:
return readonly_data_section;
case SECCAT_RODATA_MERGE_STR:
return mergeable_string_section (decl, align, 0);
case SECCAT_RODATA_MERGE_STR_INIT:
return mergeable_string_section (DECL_INITIAL (decl), align, 0);
case SECCAT_RODATA_MERGE_CONST:
return mergeable_constant_section (DECL_MODE (decl), align, 0);
case SECCAT_SRODATA:
sname = ".sdata2";
break;
[...]
All read-only sections have a special object except SECCAT_SRODATA.
Thus it is created with get_named_section() and potentially decl ==
NULL. The patch adds another special case to
default_section_type_flags().
2012-10-23 Sebastian Huber <sebastian.huber@embedded-brains.de>
PR middle-end/55033
* varasm.c (default_section_type_flags): If decl is NULL and
name is .sdata2, set flags to 0.
---
gcc/varasm.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/gcc/varasm.c b/gcc/varasm.c
index a587c80..d0941f3 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -5937,10 +5937,15 @@ default_section_type_flags (tree decl, const char *name, int reloc)
}
else
{
- flags = SECTION_WRITE;
- if (strcmp (name, ".data.rel.ro") == 0
- || strcmp (name, ".data.rel.ro.local") == 0)
- flags |= SECTION_RELRO;
+ if (strcmp (name, ".sdata2") != 0)
+ {
+ flags = SECTION_WRITE;
+ if (strcmp (name, ".data.rel.ro") == 0
+ || strcmp (name, ".data.rel.ro.local") == 0)
+ flags |= SECTION_RELRO;
+ }
+ else
+ flags = 0;
}
if (decl && DECL_ONE_ONLY (decl))
--
1.7.7
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] Potential fix for PR55033
2012-10-23 16:38 [Patch] Potential fix for PR55033 Sebastian Huber
@ 2012-10-24 15:17 ` Alan Modra
2012-10-25 9:10 ` Sebastian Huber
` (2 more replies)
2012-10-26 12:35 ` Sebastian Huber
1 sibling, 3 replies; 10+ messages in thread
From: Alan Modra @ 2012-10-24 15:17 UTC (permalink / raw)
To: Sebastian Huber; +Cc: GCC Patches
On Tue, Oct 23, 2012 at 06:25:43PM +0200, Sebastian Huber wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55033
>
> This patch fixes my problem, but I am absolutely not sure if this is the
> right way.
[snip]
This is http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9571 all over again.
IMHO your patch is not wrong, but a better idea is that if we've used
categorize_decl_for_section to choose a section name, then we ought to
also use categorize_decl_for_section to choose section flags.
My original fix for pr9571 was to pass the decl down to
get_named_section.
http://gcc.gnu.org/ml/gcc-patches/2004-11/msg02487.html
That hit the assert in get_named_section when building libgfortran for
ia64, and my knee-jerk patch to fix that was to simply satisfy the
assert. After looking at all the target section_type_flags functions,
I believe the following is what I should have done way back then.
Bootstrapped and regression tested powerpc64-linux.
* varasm.c (default_elf_select_section): Move !DECL_P check..
(get_named_section): ..to here before calling get_section_name.
Adjust assertion.
(default_section_type_flags): Add DECL_P check.
* config/i386/winnt.c (i386_pe_section_type_flags): Likewise.
* config/rs6000/rs6000.c (rs6000_xcoff_section_type_flags): Likewise.
Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c (revision 192660)
+++ gcc/varasm.c (working copy)
@@ -403,12 +403,16 @@ get_named_section (tree decl, const char *name, in
{
unsigned int flags;
- gcc_assert (!decl || DECL_P (decl));
if (name == NULL)
- name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
+ {
+ gcc_assert (decl && DECL_P (decl) && DECL_SECTION_NAME (decl));
+ name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
+ }
flags = targetm.section_type_flags (decl, name, reloc);
+ if (decl && !DECL_P (decl))
+ decl = NULL_TREE;
return get_section (name, flags, decl);
}
@@ -5943,7 +5947,7 @@ default_section_type_flags (tree decl, const char
flags |= SECTION_RELRO;
}
- if (decl && DECL_ONE_ONLY (decl))
+ if (decl && DECL_P (decl) && DECL_ONE_ONLY (decl))
flags |= SECTION_LINKONCE;
if (decl && TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl))
@@ -6299,8 +6303,6 @@ default_elf_select_section (tree decl, int reloc,
gcc_unreachable ();
}
- if (!DECL_P (decl))
- decl = NULL_TREE;
return get_named_section (decl, sname, reloc);
}
Index: gcc/config/i386/winnt.c
===================================================================
--- gcc/config/i386/winnt.c (revision 192660)
+++ gcc/config/i386/winnt.c (working copy)
@@ -476,7 +476,7 @@ i386_pe_section_type_flags (tree decl, const char
flags |= SECTION_PE_SHARED;
}
- if (decl && DECL_ONE_ONLY (decl))
+ if (decl && DECL_P (decl) && DECL_ONE_ONLY (decl))
flags |= SECTION_LINKONCE;
/* See if we already have an entry for this section. */
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 192660)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -25689,7 +25689,7 @@ rs6000_xcoff_section_type_flags (tree decl, const
unsigned int flags = default_section_type_flags (decl, name, reloc);
/* Align to at least UNIT size. */
- if (flags & SECTION_CODE || !decl)
+ if ((flags & SECTION_CODE) != 0 || !decl || !DECL_P (decl))
align = MIN_UNITS_PER_WORD;
else
/* Increase alignment of large objects if not already stricter. */
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] Potential fix for PR55033
2012-10-24 15:17 ` Alan Modra
@ 2012-10-25 9:10 ` Sebastian Huber
2012-10-30 14:18 ` Sebastian Huber
2013-01-29 14:40 ` Sebastian Huber
2 siblings, 0 replies; 10+ messages in thread
From: Sebastian Huber @ 2012-10-25 9:10 UTC (permalink / raw)
To: GCC Patches; +Cc: Alan Modra
Hello Alan,
thanks for looking at this issue.
On 10/24/2012 04:50 PM, Alan Modra wrote:
> On Tue, Oct 23, 2012 at 06:25:43PM +0200, Sebastian Huber wrote:
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55033
>>
>> This patch fixes my problem, but I am absolutely not sure if this is the
>> right way.
> [snip]
>
> This is http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9571 all over again.
>
> IMHO your patch is not wrong, but a better idea is that if we've used
> categorize_decl_for_section to choose a section name, then we ought to
> also use categorize_decl_for_section to choose section flags.
Yes, I thought about this too, but I know to little about GCC to do this on my own.
>
> My original fix for pr9571 was to pass the decl down to
> get_named_section.
> http://gcc.gnu.org/ml/gcc-patches/2004-11/msg02487.html
> That hit the assert in get_named_section when building libgfortran for
> ia64, and my knee-jerk patch to fix that was to simply satisfy the
> assert. After looking at all the target section_type_flags functions,
> I believe the following is what I should have done way back then.
> Bootstrapped and regression tested powerpc64-linux.
>
> * varasm.c (default_elf_select_section): Move !DECL_P check..
> (get_named_section): ..to here before calling get_section_name.
> Adjust assertion.
> (default_section_type_flags): Add DECL_P check.
> * config/i386/winnt.c (i386_pe_section_type_flags): Likewise.
> * config/rs6000/rs6000.c (rs6000_xcoff_section_type_flags): Likewise.
Your change fixes the problem in PR55033. I can also run the RTEMS test suite
with it, so from my point of view this looks perfect.
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] Potential fix for PR55033
2012-10-23 16:38 [Patch] Potential fix for PR55033 Sebastian Huber
2012-10-24 15:17 ` Alan Modra
@ 2012-10-26 12:35 ` Sebastian Huber
2012-10-30 14:12 ` Sebastian Huber
1 sibling, 1 reply; 10+ messages in thread
From: Sebastian Huber @ 2012-10-26 12:35 UTC (permalink / raw)
To: gcc-patches; +Cc: Alan Modra
[-- Attachment #1: Type: text/plain, Size: 365 bytes --]
Hello,
here is a test case for PR55033.
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
[-- Attachment #2: 0001-Test-case-for-PR55033.patch --]
[-- Type: text/x-patch, Size: 1025 bytes --]
From bc2020280660d5b133d907543e6d666d6c9e05e5 Mon Sep 17 00:00:00 2001
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date: Tue, 23 Oct 2012 12:27:05 +0200
Subject: [PATCH] Test case for PR55033
2012-10-26 Sebastian Huber <sebastian.huber@embedded-brains.de>
* gcc.target/powerpc/pr55033.c: New.
---
gcc/testsuite/gcc.target/powerpc/pr55033.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/powerpc/pr55033.c
diff --git a/gcc/testsuite/gcc.target/powerpc/pr55033.c b/gcc/testsuite/gcc.target/powerpc/pr55033.c
new file mode 100644
index 0000000..6b27039
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr55033.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=8540 -msoft-float -meabi -msdata" } */
+
+void f(void);
+
+struct s {
+ int *p;
+ int *q;
+};
+
+extern int a;
+
+extern const struct s c;
+
+const struct s c = { &a, 0 };
+
+void f(void)
+{
+ char buf[4] = { 0, 1, 2, 3 };
+}
--
1.7.7
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] Potential fix for PR55033
2012-10-26 12:35 ` Sebastian Huber
@ 2012-10-30 14:12 ` Sebastian Huber
2012-10-31 0:36 ` Alan Modra
0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Huber @ 2012-10-30 14:12 UTC (permalink / raw)
To: gcc-patches
On 10/26/2012 02:22 PM, Sebastian Huber wrote:
> Hello,
>
> here is a test case for PR55033.
>
Is there something wrong with this test case? It compiles well with Alan's patch.
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] Potential fix for PR55033
2012-10-24 15:17 ` Alan Modra
2012-10-25 9:10 ` Sebastian Huber
@ 2012-10-30 14:18 ` Sebastian Huber
2013-01-29 14:40 ` Sebastian Huber
2 siblings, 0 replies; 10+ messages in thread
From: Sebastian Huber @ 2012-10-30 14:18 UTC (permalink / raw)
To: GCC Patches
Hello,
what needs to be done to get this committed?
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] Potential fix for PR55033
2012-10-30 14:12 ` Sebastian Huber
@ 2012-10-31 0:36 ` Alan Modra
2012-10-31 14:02 ` Sebastian Huber
0 siblings, 1 reply; 10+ messages in thread
From: Alan Modra @ 2012-10-31 0:36 UTC (permalink / raw)
To: Sebastian Huber; +Cc: gcc-patches
On Tue, Oct 30, 2012 at 02:45:40PM +0100, Sebastian Huber wrote:
> On 10/26/2012 02:22 PM, Sebastian Huber wrote:
> >Hello,
> >
> >here is a test case for PR55033.
> >
>
> Is there something wrong with this test case? It compiles well with Alan's patch.
It looks OK to me if you replace your "gd-do compile" line with the
following two lines to avoid failures on powerpc targets that don't
support -meabi -msdata.
/* { dg-do compile { target powerpc*-*-eabi* powerpc*-*-elf* powerpc*-*-linux* } } */
/* { dg-require-effective-target ilp32 } */
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] Potential fix for PR55033
2012-10-31 0:36 ` Alan Modra
@ 2012-10-31 14:02 ` Sebastian Huber
0 siblings, 0 replies; 10+ messages in thread
From: Sebastian Huber @ 2012-10-31 14:02 UTC (permalink / raw)
To: gcc-patches; +Cc: Alan Modra
[-- Attachment #1: Type: text/plain, Size: 1395 bytes --]
Hello Alan,
maybe it is better to use a require effective target instead of the
{ target powerpc*-*-eabi* powerpc*-*-elf* powerpc*-*-linux* }
patterns scattered around in the testsuite? One problem with this is that test
cases for one of these will likely also work with powerpc*-*-rtems*. I want to
look at the remaining 104 test cases which are marked as UNSUPPORTED for RTEMS
some time in the future. Please have a look at the attached patches.
On 10/31/2012 01:12 AM, Alan Modra wrote:
> On Tue, Oct 30, 2012 at 02:45:40PM +0100, Sebastian Huber wrote:
>> On 10/26/2012 02:22 PM, Sebastian Huber wrote:
>>> Hello,
>>>
>>> here is a test case for PR55033.
>>>
>>
>> Is there something wrong with this test case? It compiles well with Alan's patch.
>
> It looks OK to me if you replace your "gd-do compile" line with the
> following two lines to avoid failures on powerpc targets that don't
> support -meabi -msdata.
>
> /* { dg-do compile { target powerpc*-*-eabi* powerpc*-*-elf* powerpc*-*-linux* } } */
> /* { dg-require-effective-target ilp32 } */
>
>
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
[-- Attachment #2: 0001-PowerPC-testsuite-clean-up.patch --]
[-- Type: text/x-patch, Size: 6609 bytes --]
From a57f179c89b5ac1bb6bf8ecfa8fa47a6e8e7c6c0 Mon Sep 17 00:00:00 2001
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date: Wed, 31 Oct 2012 10:36:49 +0100
Subject: [PATCH 1/2] PowerPC testsuite clean up
2012-10-31 Sebastian Huber <sebastian.huber@embedded-brains.de>
* lib/target-supports.exp
(check_effective_target_powerpc_canonical): New.
(check_effective_target_powerpc_eabi_ok): New.
* gcc.target/powerpc/ppc-eabi.c: Use require effective target
powerpc_eabi_ok.
* gcc.target/powerpc/ppc-sdata-1.c: Likewise.
* gcc.target/powerpc/spe-small-data-2.c: Likewise.
* gcc.target/powerpc/ppc-sdata-2.c: Use require effective target
powerpc_canonical and ilp32.
* gcc.target/powerpc/pr51623.c: Likewise.
* gcc.target/powerpc/ppc-stackalign-1.c: Use require effective target
powerpc_canonical.
* gcc.target/powerpc/ppc-ldstruct.c: Run for powerpc*-*-rtems*.
* gcc.target/powerpc/spe-small-data-2.c: Do not run, compile only.
---
gcc/testsuite/gcc.target/powerpc/ppc-eabi.c | 3 +-
gcc/testsuite/gcc.target/powerpc/ppc-ldstruct.c | 2 +-
gcc/testsuite/gcc.target/powerpc/ppc-sdata-1.c | 3 +-
gcc/testsuite/gcc.target/powerpc/ppc-sdata-2.c | 4 ++-
.../gcc.target/powerpc/ppc-stackalign-1.c | 3 +-
gcc/testsuite/gcc.target/powerpc/pr51623.c | 4 ++-
.../gcc.target/powerpc/spe-small-data-2.c | 3 +-
gcc/testsuite/lib/target-supports.exp | 23 ++++++++++++++++++++
8 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-eabi.c b/gcc/testsuite/gcc.target/powerpc/ppc-eabi.c
index 47ba1a7..cd15586 100644
--- a/gcc/testsuite/gcc.target/powerpc/ppc-eabi.c
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-eabi.c
@@ -1,4 +1,5 @@
/* PR target/16952 */
-/* { dg-do compile { target { powerpc*-*-linux* && ilp32 } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_eabi_ok } */
/* { dg-options "-meabi -mrelocatable" } */
char *s = "boo";
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-ldstruct.c b/gcc/testsuite/gcc.target/powerpc/ppc-ldstruct.c
index da6001f..ffb4264 100644
--- a/gcc/testsuite/gcc.target/powerpc/ppc-ldstruct.c
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-ldstruct.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target powerpc*-*-eabi* powerpc*-*-elf* powerpc*-*-linux* } } */
+/* { dg-do run { target powerpc*-*-eabi* powerpc*-*-elf* powerpc*-*-linux* powerpc*-*-rtems* } } */
/* { dg-options "-O -mlong-double-128" } */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-sdata-1.c b/gcc/testsuite/gcc.target/powerpc/ppc-sdata-1.c
index 5f39d86..efd5a5e 100644
--- a/gcc/testsuite/gcc.target/powerpc/ppc-sdata-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-sdata-1.c
@@ -1,5 +1,6 @@
-/* { dg-do compile { target { { powerpc*-*-linux* && ilp32 } || { powerpc-*-eabi* } } } } */
+/* { dg-do compile } */
/* { dg-options "-O2 -fno-common -G 8 -meabi -msdata=eabi" } */
+/* { dg-require-effective-target powerpc_eabi_ok } */
/* { dg-require-effective-target nonpic } */
/* { dg-final { scan-assembler "\\.section\[ \t\]\\.sdata," } } */
/* { dg-final { scan-assembler "\\.section\[ \t\]\\.sdata2," } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-sdata-2.c b/gcc/testsuite/gcc.target/powerpc/ppc-sdata-2.c
index f102b1d..fdc4030 100644
--- a/gcc/testsuite/gcc.target/powerpc/ppc-sdata-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-sdata-2.c
@@ -1,5 +1,7 @@
-/* { dg-do compile { target { { powerpc*-*-linux* && ilp32 } || { powerpc-*-eabi* } } } } */
+/* { dg-do compile } */
/* { dg-options "-O2 -fno-common -G 8 -msdata=sysv" } */
+/* { dg-require-effective-target powerpc_canonical } */
+/* { dg-require-effective-target ilp32 } */
/* { dg-require-effective-target nonpic } */
/* { dg-final { scan-assembler "\\.section\[ \t\]\\.sdata," } } */
/* { dg-final { scan-assembler-not "\\.section\[ \t\]\\.sdata2," } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-stackalign-1.c b/gcc/testsuite/gcc.target/powerpc/ppc-stackalign-1.c
index 465fc41..034ebc1 100644
--- a/gcc/testsuite/gcc.target/powerpc/ppc-stackalign-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-stackalign-1.c
@@ -1,4 +1,5 @@
-/* { dg-do run { target powerpc*-*-linux* powerpc*-*-eabi* } } */
+/* { dg-do run } */
+/* { dg-require-effective-target powerpc_canonical } */
/* { dg-options {} } */
/* Test stack pointer alignment against variable alloca. */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr51623.c b/gcc/testsuite/gcc.target/powerpc/pr51623.c
index 37b7d65..948c81f 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr51623.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr51623.c
@@ -1,5 +1,7 @@
/* PR target/51623 */
-/* { dg-do compile { target { { powerpc*-*-linux* && ilp32 } || { powerpc-*-eabi* } } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_canonical } */
+/* { dg-require-effective-target ilp32 } */
/* { dg-options "-mrelocatable -ffreestanding" } */
/* This generated an error, since the compiler was calling
diff --git a/gcc/testsuite/gcc.target/powerpc/spe-small-data-2.c b/gcc/testsuite/gcc.target/powerpc/spe-small-data-2.c
index 2a466e3..5354e49 100644
--- a/gcc/testsuite/gcc.target/powerpc/spe-small-data-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/spe-small-data-2.c
@@ -1,5 +1,6 @@
/* Verify that we don't ICE trying to put float data in .sdata2. */
-/* { dg-do run { target { powerpc*-*-linux* && powerpc_spe } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_eabi_ok } */
/* { dg-options "-msdata=eabi -mcall-eabi -G 8" } */
double x;
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 8520c8f..6ed5f52 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2494,6 +2494,29 @@ proc check_effective_target_arm_prefer_ldrd_strd { } {
} "-O2 -mthumb" ]
}
+# Return 1 if this is a canonical PowerPC target.
+
+proc check_effective_target_powerpc_canonical { } {
+ if { [istarget powerpc*-*-linux*] || [istarget powerpc-*-eabi*]
+ || [istarget powerpc-*-rtems*] } {
+ return 1;
+ } else {
+ return 0
+ }
+}
+
+# Return 1 if this is a PowerPC target supporting -meabi.
+
+proc check_effective_target_powerpc_eabi_ok { } {
+ if { [istarget powerpc*-*-*] } {
+ return [check_no_compiler_messages powerpc_eabi_ok object {
+ int dummy;
+ } "-meabi"]
+ } else {
+ return 0
+ }
+}
+
# Return 1 if this is a PowerPC target with floating-point registers.
proc check_effective_target_powerpc_fprs { } {
--
1.7.7
[-- Attachment #3: 0002-Test-case-for-PR55033.patch --]
[-- Type: text/x-patch, Size: 1110 bytes --]
From 0a8c10e6f41339c16557a76dd11a4de08244acdf Mon Sep 17 00:00:00 2001
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date: Tue, 23 Oct 2012 12:27:05 +0200
Subject: [PATCH 2/2] Test case for PR55033
2012-10-31 Sebastian Huber <sebastian.huber@embedded-brains.de>
PR target/55033
* gcc.target/powerpc/pr55033.c: New.
---
gcc/testsuite/gcc.target/powerpc/pr55033.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/powerpc/pr55033.c
diff --git a/gcc/testsuite/gcc.target/powerpc/pr55033.c b/gcc/testsuite/gcc.target/powerpc/pr55033.c
new file mode 100644
index 0000000..cd8abcb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr55033.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_eabi_ok } */
+/* { dg-options "-mcpu=8540 -msoft-float -msdata=eabi -G 8 -fno-common" } */
+
+void f(void);
+
+struct s {
+ int *p;
+ int *q;
+};
+
+extern int a;
+
+extern const struct s c;
+
+const struct s c = { &a, 0 };
+
+void f(void)
+{
+ char buf[4] = { 0, 1, 2, 3 };
+}
--
1.7.7
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] Potential fix for PR55033
2012-10-24 15:17 ` Alan Modra
2012-10-25 9:10 ` Sebastian Huber
2012-10-30 14:18 ` Sebastian Huber
@ 2013-01-29 14:40 ` Sebastian Huber
2013-01-29 17:05 ` Sebastian Huber
2 siblings, 1 reply; 10+ messages in thread
From: Sebastian Huber @ 2013-01-29 14:40 UTC (permalink / raw)
To: gcc-patches
Hello,
is it possible to integrate this patch into the GCC 4.8 release?
On 10/24/2012 04:50 PM, Alan Modra wrote:
> On Tue, Oct 23, 2012 at 06:25:43PM +0200, Sebastian Huber wrote:
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55033
>>
>> This patch fixes my problem, but I am absolutely not sure if this is the
>> right way.
> [snip]
>
> This is http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9571 all over again.
>
> IMHO your patch is not wrong, but a better idea is that if we've used
> categorize_decl_for_section to choose a section name, then we ought to
> also use categorize_decl_for_section to choose section flags.
>
> My original fix for pr9571 was to pass the decl down to
> get_named_section.
> http://gcc.gnu.org/ml/gcc-patches/2004-11/msg02487.html
> That hit the assert in get_named_section when building libgfortran for
> ia64, and my knee-jerk patch to fix that was to simply satisfy the
> assert. After looking at all the target section_type_flags functions,
> I believe the following is what I should have done way back then.
> Bootstrapped and regression tested powerpc64-linux.
>
> * varasm.c (default_elf_select_section): Move !DECL_P check..
> (get_named_section): ..to here before calling get_section_name.
> Adjust assertion.
> (default_section_type_flags): Add DECL_P check.
> * config/i386/winnt.c (i386_pe_section_type_flags): Likewise.
> * config/rs6000/rs6000.c (rs6000_xcoff_section_type_flags): Likewise.
>
> Index: gcc/varasm.c
> ===================================================================
> --- gcc/varasm.c (revision 192660)
> +++ gcc/varasm.c (working copy)
> @@ -403,12 +403,16 @@ get_named_section (tree decl, const char *name, in
> {
> unsigned int flags;
>
> - gcc_assert (!decl || DECL_P (decl));
> if (name == NULL)
> - name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
> + {
> + gcc_assert (decl && DECL_P (decl) && DECL_SECTION_NAME (decl));
> + name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
> + }
>
> flags = targetm.section_type_flags (decl, name, reloc);
>
> + if (decl && !DECL_P (decl))
> + decl = NULL_TREE;
> return get_section (name, flags, decl);
> }
>
> @@ -5943,7 +5947,7 @@ default_section_type_flags (tree decl, const char
> flags |= SECTION_RELRO;
> }
>
> - if (decl && DECL_ONE_ONLY (decl))
> + if (decl && DECL_P (decl) && DECL_ONE_ONLY (decl))
> flags |= SECTION_LINKONCE;
>
> if (decl && TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl))
> @@ -6299,8 +6303,6 @@ default_elf_select_section (tree decl, int reloc,
> gcc_unreachable ();
> }
>
> - if (!DECL_P (decl))
> - decl = NULL_TREE;
> return get_named_section (decl, sname, reloc);
> }
>
> Index: gcc/config/i386/winnt.c
> ===================================================================
> --- gcc/config/i386/winnt.c (revision 192660)
> +++ gcc/config/i386/winnt.c (working copy)
> @@ -476,7 +476,7 @@ i386_pe_section_type_flags (tree decl, const char
> flags |= SECTION_PE_SHARED;
> }
>
> - if (decl && DECL_ONE_ONLY (decl))
> + if (decl && DECL_P (decl) && DECL_ONE_ONLY (decl))
> flags |= SECTION_LINKONCE;
>
> /* See if we already have an entry for this section. */
> Index: gcc/config/rs6000/rs6000.c
> ===================================================================
> --- gcc/config/rs6000/rs6000.c (revision 192660)
> +++ gcc/config/rs6000/rs6000.c (working copy)
> @@ -25689,7 +25689,7 @@ rs6000_xcoff_section_type_flags (tree decl, const
> unsigned int flags = default_section_type_flags (decl, name, reloc);
>
> /* Align to at least UNIT size. */
> - if (flags & SECTION_CODE || !decl)
> + if ((flags & SECTION_CODE) != 0 || !decl || !DECL_P (decl))
> align = MIN_UNITS_PER_WORD;
> else
> /* Increase alignment of large objects if not already stricter. */
>
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] Potential fix for PR55033
2013-01-29 14:40 ` Sebastian Huber
@ 2013-01-29 17:05 ` Sebastian Huber
0 siblings, 0 replies; 10+ messages in thread
From: Sebastian Huber @ 2013-01-29 17:05 UTC (permalink / raw)
To: gcc-patches
On 01/29/2013 03:40 PM, Sebastian Huber wrote:
> Hello,
>
> is it possible to integrate this patch into the GCC 4.8 release?
With this patch we have:
LAST_UPDATED: Mon Jan 28 07:50:05 UTC 2013 (revision
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3)
Native configuration is x86_64-unknown-linux-gnu
=== gcc tests ===
Running target unix
XPASS: gcc.dg/inline_3.c (test for excess errors)
XPASS: gcc.dg/inline_4.c (test for excess errors)
XPASS: gcc.dg/unroll_2.c (test for excess errors)
XPASS: gcc.dg/unroll_3.c (test for excess errors)
XPASS: gcc.dg/unroll_4.c (test for excess errors)
=== gcc Summary ===
# of expected passes 92116
# of unexpected successes 5
# of expected failures 257
# of unsupported tests 1522
/scratch/git-build/b-gcc-git-linux/gcc/xgcc version 4.8.0 20130128
(experimental) [master revision
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3] (GCC)
=== g++ tests ===
Running target unix
=== g++ Summary ===
# of expected passes 53540
# of expected failures 289
# of unsupported tests 738
/scratch/git-build/b-gcc-git-linux/gcc/testsuite/g++/../../xg++ version 4.8.0
20130128 (experimental) [master revision
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3] (GCC)
Compiler version: 4.8.0 20130128 (experimental) [master revision
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3] (GCC)
Platform: x86_64-unknown-linux-gnu
configure flags: --prefix=/scratch/install-gcc-git --verbose --with-gnu-as
--with-gnu-ld --enable-languages=c,c++
Without this patch we have:
LAST_UPDATED: Mon Jan 28 07:50:05 UTC 2013 (revision
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3)
Native configuration is x86_64-unknown-linux-gnu
=== gcc tests ===
Running target unix
XPASS: gcc.dg/inline_3.c (test for excess errors)
XPASS: gcc.dg/inline_4.c (test for excess errors)
XPASS: gcc.dg/unroll_2.c (test for excess errors)
XPASS: gcc.dg/unroll_3.c (test for excess errors)
XPASS: gcc.dg/unroll_4.c (test for excess errors)
=== gcc Summary ===
# of expected passes 92116
# of unexpected successes 5
# of expected failures 257
# of unsupported tests 1522
/scratch/git-build/b-gcc-git-linux/gcc/xgcc version 4.8.0 20130128
(experimental) [master revision
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3] (GCC)
=== g++ tests ===
Running target unix
=== g++ Summary ===
# of expected passes 53540
# of expected failures 289
# of unsupported tests 738
/scratch/git-build/b-gcc-git-linux/gcc/testsuite/g++/../../xg++ version 4.8.0
20130128 (experimental) [master revision
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3] (GCC)
Compiler version: 4.8.0 20130128 (experimental) [master revision
5c2b636:7d84cac:9fc8b0bfcfe944067fc4c75d8b3f97eab67cecf3] (GCC)
Platform: x86_64-unknown-linux-gnu
configure flags: --prefix=/scratch/install-gcc-git --verbose --with-gnu-as
--with-gnu-ld --enable-languages=c,c++
=> No new regressions on platform x86_64-unknown-linux-gnu for C and C++
Some PowerPC results are here:
http://gcc.gnu.org/ml/gcc-testresults/2013-01/msg03064.html
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-01-29 17:05 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-23 16:38 [Patch] Potential fix for PR55033 Sebastian Huber
2012-10-24 15:17 ` Alan Modra
2012-10-25 9:10 ` Sebastian Huber
2012-10-30 14:18 ` Sebastian Huber
2013-01-29 14:40 ` Sebastian Huber
2013-01-29 17:05 ` Sebastian Huber
2012-10-26 12:35 ` Sebastian Huber
2012-10-30 14:12 ` Sebastian Huber
2012-10-31 0:36 ` Alan Modra
2012-10-31 14:02 ` Sebastian Huber
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).