treehydra_generated.c fails to compile with latest gcc 4.5 trunk




Rewriting and Analysis
8 years ago
7 years ago


(Reporter: Swatinem, Assigned: (dormant account))


Dependency tree / graph

Firefox Tracking Flags

(Not tracked)



(1 attachment)



8 years ago
treehydra_generated.c: In function 'lazy_lang_decl_min':
treehydra_generated.c:1205: error: 'struct lang_decl_min' has no member named 'u'

I will hopefully find time soon to look into this failure.

Comment 1

8 years ago
cp/cp-tree.h contains this struct:

struct GTY(()) lang_decl_min {
  struct lang_decl_base base;
  union lang_decl_u2 {
  } GTY ((desc ("%0.u.base.u2sel"))) u2;

which is then converted by convert_tree.js callUnion and getUnionResolver to 
convert_lang_decl_u2_union (this, (*topmost).u.base.u2sel, &topmost->u2, obj_u2);

where getUnionResolver uses the "desc" provided in the gcc header, which is clearly wrong as it points to a non existing member thus causing the build failure.

I believe this is clearly a bug in the gcc header and needs to be fixed in gcc rather than dehydra, right?


8 years ago
Blocks: 527205

Comment 2

8 years ago
(In reply to comment #1)

> I believe this is clearly a bug in the gcc header and needs to be fixed in gcc
> rather than dehydra, right?

yes. I'm surprised this doesn't make gcc angry during compilation.

Comment 3

8 years ago
This is not a bug in gcc. This is a bug in my understanding of the GTY "spec" :(

I assumed %0 meant outermost struct in stuff like struct outermost { struct nested{}}. But it seems what it actually means is that %0 is outermost struct for structs declared by value.

This basically means that I have to "inline" more aggressively :(

Comment 4

8 years ago
Created attachment 414567 [details] [diff] [review]

There are two solutions here. One is to figure out exactly how gengtype nests structs and do the same thing. I don't feel that it is a good idea to generate bloated binding functions, nor do I feel like rewriting the whole of convert_type.js paradigm to be that way.

Alternative is to traverse the struct member graph and figure out exactly which structs need to be "inlined" for %0 to work. That's what this patch does.
In fact, using this approach results in more sensible code and better utilization of dehydra features(instead of ad-hoc ways of doing this as I do currently). Unfortunately I broke Treehydra for 4.3 when I utilized this for all of the gty %tags, so I wont be revisiting that until I no longer have to support multiple compilers.
Attachment #414567 - Flags: review?(benjamin)
Attachment #414567 - Attachment is patch: true
Attachment #414567 - Attachment mime type: application/octet-stream → text/plain
Comment on attachment 414567 [details] [diff] [review]

spelling nit s/nexted/nested/
Attachment #414567 - Flags: review?(benjamin) → review+


7 years ago
Last Resolved: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.