Dan Nelson wrote: > I guess the correct question to be asking is "does the ELF format allow > 0-length symbols?" It does, according to my reading of it. They may have an issue with dead code removal or element aliasing. The way to find out would be to see what they emit for "[]"... 0 lenth, or 1? > If not, then gcc is generating invalid objects, and > genassym will have to be rewritten to not use them (maybe add one to > the array size, and have genassym.sh subtract it). If it does, then > genassym.c (sys/assym.h actually) is legal code. If Intel doesn't want > to change icc, we can still work around it, but there may be other code > that will break on icc just like assym.h. For example, an actual array of length 1 would mean you were screwed, since treating 1 as if it were 0 would treat that as zero, as well, and get the wrong answer. The real answer is that the code should probably use an array length of one, and then use the address of the array length 1 element, rather than the address of the object plus the size of the object, when it's trying to use the zero length array trick to glue data with the correct object alignment (according to the array type) onto the end of a structure, which is where most of this type of code comes from. Unfortunately, the genassym.sh is a special case; for it to work out if you changed the nature of the trick, the script would need to grow special knowledge of the symbols in question. That is probably going to be the answer in any case, if Intel is unwilling/unable to adopt the GCC-ism. Anecdote on "unable": At one point in time SEF had to deal with a compiler issue with the Microsoft C compiler used by SCO; it took code like this: char *hw = "Hello World!\n" + 6; and generated a data segment missing the "Hello ". When the code later did this: printf( "%s", hw - 6); It got the wrong answer. The problem was the MS compiler was unable to gerate a pseudo-symbol for the start of the data, and so had no way of taking the origina string, and allocating storage, with a static symbol offset +6 into the string. If Intel ICC makes an optimization based on pruning of actually zero-length element, or not aligning them to their type boundary, etc., it would take deep compiler voodoo to correct this. Hopefully, they do the right thing for "[]". -- TerryReceived on Thu Sep 04 2003 - 23:40:33 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:21 UTC