diff mbox

RFA: fix avr compile/limits-externdecl.c failures

Message ID 20130513133612.glrz50hlw0kg8sk8-nzlynne@webmail.spamcop.net
State New
Headers show

Commit Message

Joern Rennecke May 13, 2013, 5:36 p.m. UTC
All the gcc.c-torture/compile/limits-externdecl.c currently give an
error: size of array is too large, followed by an ICE in
avr_encode_section_info, which goes on to try to find the address space
of error_mark_node.

Given the size of the array, it makes sense for the test to give an error
where POINTER_SIZE is 16 bit, but then, we should mark this as an expected
error for this target.
Moreover, we shouldn't ICE after the error.

The attached patch implements both these changes.

regression tested for i686-pc-linux-gnu X avr, Running target atmega128-sim
2013-05-13  Joern Rennecke <joern.rennecke@embecosm.com>

gcc:
	* config/avr/avr.c (avr_encode_section_info): Bail out if the type
	is error_mark_node.
gcc/testsuite:
	* testsuite/gcc.c-torture/compile/limits-externdecl.c [target avr-*-*]:
	Expect "size of array is too large" error.

Comments

Denis Chertykov May 14, 2013, 11:16 a.m. UTC | #1
2013/5/13 Joern Rennecke <joern.rennecke@embecosm.com>
>
> All the gcc.c-torture/compile/limits-externdecl.c currently give an
> error: size of array is too large, followed by an ICE in
> avr_encode_section_info, which goes on to try to find the address space
> of error_mark_node.
>
> Given the size of the array, it makes sense for the test to give an error
> where POINTER_SIZE is 16 bit, but then, we should mark this as an expected
> error for this target.
> Moreover, we shouldn't ICE after the error.
>
> The attached patch implements both these changes.
>
> regression tested for i686-pc-linux-gnu X avr, Running target atmega128-sim
>
> 2013-05-13  Joern Rennecke <joern.rennecke@embecosm.com>
>
> gcc:
>         * config/avr/avr.c (avr_encode_section_info): Bail out if the type
>         is error_mark_node.
> gcc/testsuite:
>         * testsuite/gcc.c-torture/compile/limits-externdecl.c [target avr-*-*]:
>         Expect "size of array is too large" error.
>

Applied.

Denis.
diff mbox

Patch

Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c	(revision 198829)
+++ config/avr/avr.c	(working copy)
@@ -8324,7 +8324,11 @@  avr_encode_section_info (tree decl, rtx
       && SYMBOL_REF == GET_CODE (XEXP (rtl, 0)))
    {
       rtx sym = XEXP (rtl, 0);
-      addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (decl));
+      tree type = TREE_TYPE (decl);
+
+      if (type == error_mark_node)
+	return;
+      addr_space_t as = TYPE_ADDR_SPACE (type);
 
       /* PSTR strings are in generic space but located in flash:
          patch address space.  */
Index: testsuite/gcc.c-torture/compile/limits-externdecl.c
===================================================================
--- testsuite/gcc.c-torture/compile/limits-externdecl.c	(revision 198829)
+++ testsuite/gcc.c-torture/compile/limits-externdecl.c	(working copy)
@@ -52,4 +52,4 @@  #define LIM6(x) LIM5(x##0) LIM5(x##1) LI
 REFERENCE references[] = {
   LIM5 (X)
   0
-};
+}; /* { dg-error "size of array is too large" "" { target avr-*-* } } */