This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I was aware of some of your points and was hoping to address them before resubmission. However, I will take your review to give me the green light to commit, once I have sorted them out.
I think this is OK to commit, modulo a few questions/comments mentioned below, and one PR that will need to be filed against it.
I concluded so, although I will check the logic once more.
This seems to rely on the s->offset values being in ascending order; otherwise there will be false positives. Can we rely on this?
I did wonder about this when I changed from get_mem to alloca - I was of the opinion that this equivalencing could/should only be done for small arrays. I'll revert it.
+ /* Now absorb all the initializer data into a single vector, + whilst checking for overlapping, unequal values. */ + data = (unsigned char*)alloca ((size_t)length);
For large arrays, the data array could be quite large. Do we really want to use alloca to put it on the stack?
Will do.
+ memset (data, '\0', (size_t)length);
I think this line should have a TODO comment above it, noting that it may need to be changed (or at least looked at) when -finit-local-zero sorts of options are implemented to provide values other than zero.
[...]+ known_align = 0; + if (known_align == 0 || known_align > BIGGEST_ALIGNMENT) + known_align = BIGGEST_ALIGNMENT;
This if-statement is always true, because of the preceeding line. What did you really mean here? :)
[...]+ for (i = 0; i < (int)len; i++) + { + if (data[i] && (check[i] != data[i])) + { + gfc_error ("Overlapping unequal initializers in EQUIVALENCE " + "at %L", &e->where); + return 0; + } + }
This will, of course, fail to detect the overlapping unequal initializers if the first one is initializing things to zero.
IMO, it's probably okay to go ahead and commit this with this flaw, but if you do, please file a PR about it and add a TODO comment to the code. Also, please assign the PR to me unless you think you'll have time to fix it. :)
+ len = len + gfc_merge_initializers (ts, c->expr, &data[len], + length - len); + + gcc_assert (len <= length);
This assert is IMO unnecessary, since it can be seen solely from analysis of this function that it will always be true.
'tis the reporter's choice - I take your point and will change it.
+ subroutine int4_int4 + integer(4) NUNITS(4) + integer(4) o + equivalence (o,nunits(3))
"o" seems like a singularly poor choice for a variable name, and "NUNITS" looks like it should mean something but it doesn't. Could these perhaps be A and B instead?
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |