On Thu, Apr 14, 2005 at 03:02:36PM -0700, James E Wilson wrote:
> Martin Koegler wrote:
> >I changed the attribute handler to only return NULL_TREE in any case, but
> >the result is still the same (using the same gcc core).
> 
> But you are still creating the types in the attribute function right? 
> If so, that is probably why you still have a problem.
No, the first statement in the attribut handler is return NULL_TREE, so it
can not create a type.

I added to the i386 version the following code (using a unmodified gcc for the 
rest):
[EMAIL PROTECTED]:/tmp/gcc/gcc]$cvs diff -u config/i386/i386.c
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.808
diff -u -r1.808 i386.c
--- config/i386/i386.c  12 Apr 2005 01:46:28 -0000      1.808
+++ config/i386/i386.c  16 Apr 2005 12:37:52 -0000
@@ -1608,9 +1608,19 @@
 #endif
 }


+
+static tree
+m68hc05_handle_eeprom_attribute (tree * node, tree name,
+                                tree args ATTRIBUTE_UNUSED,
+                                int flags ATTRIBUTE_UNUSED,
+                                bool * no_add_attrs)
+{
+  return NULL_TREE;
+}
 /* Table of valid machine attributes.  */
 const struct attribute_spec ix86_attribute_table[] =
 {
+  {"eeprom", 0, 0, false, true, false, m68hc05_handle_eeprom_attribute},
   /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
   /* Stdcall attribute says callee is responsible for popping arguments
      if they are not variable.  */

This creates a usedless attribute named eeprom, and I think, that this code
should not contain any error.

Then it fails for at the line (the latest CVS version as well as 20050412):
$cat x.c
typedef unsigned char GROUP9_T[3];
typedef GROUP9_T EGROUP9_T __attribute ((eeprom));
$./cc1 --version
GNU C version 4.1.0 20050416 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 4.1.0 20050302 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
$./cc1 -g x.c
x.c:2: internal compiler error: in modified_type_die, at dwarf2out.c:8362
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

So the problem is in the core or I have defined the attribute in i386.c in a
wrong way. Correct me, if my modification is not allowed or does an other
forbidden thing.

> You mentioned that this works for all types except array types.  Instead 
> of trying to figure out why array types don't work, perhaps you should 
> figure out why other types do work, and then maybe you can understand 
> why array types don't work.
> 
> Looking at this, I see that you have two array types, both with the same 
> typename which points at the same type decl.  It doesn't seem right for 
> two different types to both claim to be the same typedef.  That doesn't 
> seem to be an issue though.

I tried to compare the differences on the modified i386 with the file:
typedef unsigned char uchar;
typedef uchar euchar __attribute ((eeprom));
typedef unsigned char GROUP9_T[3];
typedef GROUP9_T EGROUP9_T __attribute ((eeprom));
The only difference I have noticed, is that GROUP9_T has no TYPE_NAME, but 
uchar has.
type->type.type_main_variant equals type in any case.

typedef usigned char uchar;
(gdb) call debug_tree(type)
 <integer_type 0xb7f07360 unsigned char public unsigned QI
    size <integer_cst 0xb7eff210 type <integer_type 0xb7f07288 bit_size_type> 
constant invariant 8>
    unit size <integer_cst 0xb7eff228 type <integer_type 0xb7f0721c unsigned 
int> constant invariant 1>
    align 8 symtab 0 alias set -1 precision 8 min <integer_cst 0xb7eff288 0> 
max <integer_cst 0xb7eff2a0 255>>
(gdb) call debug_tree(type->type.name)
 <type_decl 0xb7f07d14 unsigned char
    type <integer_type 0xb7f07360 unsigned char public unsigned QI
        size <integer_cst 0xb7eff210 constant invariant 8>
        unit size <integer_cst 0xb7eff228 constant invariant 1>
        align 8 symtab 0 alias set -1 precision 8 min <integer_cst 0xb7eff288 
0> max <integer_cst 0xb7eff2a0 255>>
    VOID file <built-in> line 0
    align 1>
(gdb) call debug_tree(type->type.name->decl.result)

(gdb) call debug_tree(type->type.main_variant)
 <integer_type 0xb7f07360 unsigned char public unsigned QI
    size <integer_cst 0xb7eff210 type <integer_type 0xb7f07288 bit_size_type> 
constant invariant 8>
    unit size <integer_cst 0xb7eff228 type <integer_type 0xb7f0721c unsigned 
int> constant invariant 1>
    align 8 symtab 0 alias set -1 precision 8 min <integer_cst 0xb7eff288 0> 
max <integer_cst 0xb7eff2a0 255>>


typedef uchar euchar __attribute((eeprom));
(gdb) call debug_tree(type)
 <integer_type 0xb7f74e58 uchar unsigned QI
    size <integer_cst 0xb7eff210 type <integer_type 0xb7f07288 bit_size_type> 
constant invariant 8>
    unit size <integer_cst 0xb7eff228 type <integer_type 0xb7f0721c unsigned 
int> constant invariant 1>
    align 8 symtab 0 alias set -1
    attributes <tree_list 0xb7f7b468
        purpose <identifier_node 0xb7f771a0 eeprom>> precision 8 min 
<integer_cst 0xb7eff288 0> max <integer_cst 0xb7eff2a0 255>>
(gdb) call debug_tree(type->type.name)
 <type_decl 0xb7f74d14 uchar
    type <integer_type 0xb7f74d80 uchar unsigned QI
        size <integer_cst 0xb7eff210 constant invariant 8>
        unit size <integer_cst 0xb7eff228 constant invariant 1>
        align 8 symtab -1208520444 alias set -1 precision 8 min <integer_cst 
0xb7eff288 0> max <integer_cst 0xb7eff2a0 255>>
    asm_written VOID file x1.c line 1
    align 1
    result <integer_type 0xb7f07360 unsigned char public unsigned QI size 
<integer_cst 0xb7eff210 8> unit size <integer_cst 0xb7eff228 1>
        align 8 symtab -1208520392 alias set -1 precision 8 min <integer_cst 
0xb7eff288 0> max <integer_cst 0xb7eff2a0 255>>>
(gdb) call debug_tree(type->type.name->decl.result)
 <integer_type 0xb7f07360 unsigned char public unsigned QI
    size <integer_cst 0xb7eff210 type <integer_type 0xb7f07288 bit_size_type> 
constant invariant 8>
    unit size <integer_cst 0xb7eff228 type <integer_type 0xb7f0721c unsigned 
int> constant invariant 1>
    align 8 symtab -1208520392 alias set -1 precision 8 min <integer_cst 
0xb7eff288 0> max <integer_cst 0xb7eff2a0 255>>
(gdb) call debug_tree(type->type.main_variant)
 <integer_type 0xb7f74e58 uchar unsigned QI
    size <integer_cst 0xb7eff210 type <integer_type 0xb7f07288 bit_size_type> 
constant invariant 8>
    unit size <integer_cst 0xb7eff228 type <integer_type 0xb7f0721c unsigned 
int> constant invariant 1>
    align 8 symtab 0 alias set -1
    attributes <tree_list 0xb7f7b468
        purpose <identifier_node 0xb7f771a0 eeprom>> precision 8 min 
<integer_cst 0xb7eff288 0> max <integer_cst 0xb7eff2a0 255>>


typedef unsigned char GROUP9_T[3];
(gdb) call debug_tree(type)
 <array_type 0xb7f7c000
    type <integer_type 0xb7f07360 unsigned char public unsigned QI
        size <integer_cst 0xb7eff210 constant invariant 8>
        unit size <integer_cst 0xb7eff228 constant invariant 1>
        align 8 symtab -1208520392 alias set -1 precision 8 min <integer_cst 
0xb7eff288 0> max <integer_cst 0xb7eff2a0 255>
        pointer_to_this <pointer_type 0xb7f7c06c>>
    BLK
    size <integer_cst 0xb7f7b558 type <integer_type 0xb7f07288 bit_size_type> 
constant invariant 24>
    unit size <integer_cst 0xb7eff378 type <integer_type 0xb7f0721c unsigned 
int> constant invariant 3>
    align 8 symtab 0 alias set -1
    domain <integer_type 0xb7f74f30
        type <integer_type 0xb7f0721c unsigned int public unsigned sizetype SI
            size <integer_cst 0xb7eff408 constant invariant 32>
            unit size <integer_cst 0xb7eff198 constant invariant 4>
            align 32 symtab 0 alias set -1 precision 32 min <integer_cst 
0xb7eff480 0> max <integer_cst 0xb7eff468 4294967295>>
        SI size <integer_cst 0xb7eff408 32> unit size <integer_cst 0xb7eff198 4>
        align 32 symtab 0 alias set -1 precision 32 min <integer_cst 0xb7eff1b0 
0> max <integer_cst 0xb7eff330 2>>>
(gdb) call debug_tree(type->type.name)

(gdb) call debug_tree(type->type.main_variant)
 <array_type 0xb7f7c000
    type <integer_type 0xb7f07360 unsigned char public unsigned QI
        size <integer_cst 0xb7eff210 constant invariant 8>
        unit size <integer_cst 0xb7eff228 constant invariant 1>
        align 8 symtab -1208520392 alias set -1 precision 8 min <integer_cst 
0xb7eff288 0> max <integer_cst 0xb7eff2a0 255>
        pointer_to_this <pointer_type 0xb7f7c06c>>
    BLK
    size <integer_cst 0xb7f7b558 type <integer_type 0xb7f07288 bit_size_type> 
constant invariant 24>
    unit size <integer_cst 0xb7eff378 type <integer_type 0xb7f0721c unsigned 
int> constant invariant 3>
    align 8 symtab 0 alias set -1
    domain <integer_type 0xb7f74f30
        type <integer_type 0xb7f0721c unsigned int public unsigned sizetype SI
            size <integer_cst 0xb7eff408 constant invariant 32>
            unit size <integer_cst 0xb7eff198 constant invariant 4>
            align 32 symtab 0 alias set -1 precision 32 min <integer_cst 
0xb7eff480 0> max <integer_cst 0xb7eff468 4294967295>>
        SI size <integer_cst 0xb7eff408 32> unit size <integer_cst 0xb7eff198 4>
        align 32 symtab 0 alias set -1 precision 32 min <integer_cst 0xb7eff1b0 
0> max <integer_cst 0xb7eff330 2>>>

typedef GROUP9_T EGROUP9_T __attribute((eeprom));
(gdb) call debug_tree(type)
 <array_type 0xb7f7c21c GROUP9_T
    type <integer_type 0xb7f07360 unsigned char asm_written public unsigned QI
        size <integer_cst 0xb7eff210 constant invariant 8>
        unit size <integer_cst 0xb7eff228 constant invariant 1>
        align 8 symtab -1208520392 alias set -1 precision 8 min <integer_cst 
0xb7eff288 0> max <integer_cst 0xb7eff2a0 255>
        pointer_to_this <pointer_type 0xb7f7c06c>>
    BLK
    size <integer_cst 0xb7f7b558 type <integer_type 0xb7f07288 bit_size_type> 
constant invariant 24>
    unit size <integer_cst 0xb7eff378 type <integer_type 0xb7f0721c unsigned 
int> constant invariant 3>
    align 8 symtab 0 alias set -1
    attributes <tree_list 0xb7f7b690
        purpose <identifier_node 0xb7f771a0 eeprom>>
    domain <integer_type 0xb7f74f30
        type <integer_type 0xb7f0721c unsigned int public unsigned sizetype SI
            size <integer_cst 0xb7eff408 constant invariant 32>
            unit size <integer_cst 0xb7eff198 constant invariant 4>
            align 32 symtab -1208519924 alias set -1 precision 32 min 
<integer_cst 0xb7eff480 0> max <integer_cst 0xb7eff468 4294967295>>
        SI size <integer_cst 0xb7eff408 32> unit size <integer_cst 0xb7eff198 4>
        align 32 symtab 0 alias set -1 precision 32 min <integer_cst 0xb7eff1b0 
0> max <integer_cst 0xb7eff330 2>>>
(gdb) call debug_tree(type->type.name)
 <type_decl 0xb7f7c0d8 GROUP9_T
    type <array_type 0xb7f7c144 GROUP9_T
        type <integer_type 0xb7f07360 unsigned char asm_written public unsigned 
QI
            size <integer_cst 0xb7eff210 constant invariant 8>
            unit size <integer_cst 0xb7eff228 constant invariant 1>
            align 8 symtab -1208520392 alias set -1 precision 8 min 
<integer_cst 0xb7eff288 0> max <integer_cst 0xb7eff2a0 255>
            pointer_to_this <pointer_type 0xb7f7c06c>>
        BLK
        size <integer_cst 0xb7f7b558 constant invariant 24>
        unit size <integer_cst 0xb7eff378 constant invariant 3>
        align 8 symtab -1208520080 alias set -1
        domain <integer_type 0xb7f74f30 type <integer_type 0xb7f0721c unsigned 
int>
            SI
            size <integer_cst 0xb7eff408 constant invariant 32>
            unit size <integer_cst 0xb7eff198 constant invariant 4>
            align 32 symtab 0 alias set -1 precision 32 min <integer_cst 
0xb7eff1b0 0> max <integer_cst 0xb7eff330 2>>>
    asm_written VOID file x1.c line 3
    align 1
    result <array_type 0xb7f7c000 type <integer_type 0xb7f07360 unsigned char>
        asm_written BLK size <integer_cst 0xb7f7b558 24> unit size <integer_cst 
0xb7eff378 3>
        align 8 symtab -1208520028 alias set -1 domain <integer_type 
0xb7f74f30>>>
(gdb) call debug_tree(type->type.name->decl.result)
 <array_type 0xb7f7c000
    type <integer_type 0xb7f07360 unsigned char asm_written public unsigned QI
        size <integer_cst 0xb7eff210 constant invariant 8>
        unit size <integer_cst 0xb7eff228 constant invariant 1>
        align 8 symtab -1208520392 alias set -1 precision 8 min <integer_cst 
0xb7eff288 0> max <integer_cst 0xb7eff2a0 255>
        pointer_to_this <pointer_type 0xb7f7c06c>>
    asm_written BLK
    size <integer_cst 0xb7f7b558 type <integer_type 0xb7f07288 bit_size_type> 
constant invariant 24>
    unit size <integer_cst 0xb7eff378 type <integer_type 0xb7f0721c unsigned 
int> constant invariant 3>
    align 8 symtab -1208520028 alias set -1
    domain <integer_type 0xb7f74f30
        type <integer_type 0xb7f0721c unsigned int public unsigned sizetype SI
            size <integer_cst 0xb7eff408 constant invariant 32>
            unit size <integer_cst 0xb7eff198 constant invariant 4>
            align 32 symtab -1208519924 alias set -1 precision 32 min 
<integer_cst 0xb7eff480 0> max <integer_cst 0xb7eff468 4294967295>>
        SI size <integer_cst 0xb7eff408 32> unit size <integer_cst 0xb7eff198 4>
        align 32 symtab 0 alias set -1 precision 32 min <integer_cst 0xb7eff1b0 
0> max <integer_cst 0xb7eff330 2>>>
(gdb) call debug_tree(type->type.main_variant)
 <array_type 0xb7f7c21c GROUP9_T
    type <integer_type 0xb7f07360 unsigned char asm_written public unsigned QI
        size <integer_cst 0xb7eff210 constant invariant 8>
        unit size <integer_cst 0xb7eff228 constant invariant 1>
        align 8 symtab -1208520392 alias set -1 precision 8 min <integer_cst 
0xb7eff288 0> max <integer_cst 0xb7eff2a0 255>
        pointer_to_this <pointer_type 0xb7f7c06c>>
    BLK
    size <integer_cst 0xb7f7b558 type <integer_type 0xb7f07288 bit_size_type> 
constant invariant 24>
    unit size <integer_cst 0xb7eff378 type <integer_type 0xb7f0721c unsigned 
int> constant invariant 3>
    align 8 symtab 0 alias set -1
    attributes <tree_list 0xb7f7b690
        purpose <identifier_node 0xb7f771a0 eeprom>>
    domain <integer_type 0xb7f74f30
        type <integer_type 0xb7f0721c unsigned int public unsigned sizetype SI
            size <integer_cst 0xb7eff408 constant invariant 32>
            unit size <integer_cst 0xb7eff198 constant invariant 4>
            align 32 symtab -1208519924 alias set -1 precision 32 min 
<integer_cst 0xb7eff480 0> max <integer_cst 0xb7eff468 4294967295>>
        SI size <integer_cst 0xb7eff408 32> unit size <integer_cst 0xb7eff198 4>
        align 32 symtab 0 alias set -1 precision 32 min <integer_cst 0xb7eff1b0 
0> max <integer_cst 0xb7eff330 2>>>

mfg Martin Kögler
[EMAIL PROTECTED]

Reply via email to