[Patch, Fortran, OOP] PR 46971: [4.6 Regression] ICE on long class names

Janus Weil janus@gcc.gnu.org
Thu Dec 30 23:12:00 GMT 2010


Hi Thomas,

>> A stronger argument would be the lack of uniqueness, i.e. a hashed
>> name colliding with a plain-text name, but I think this is practically
>> impossible.
>
> I think we have had that discussion before, sort of :-)

at least a similar one ...


> Could you maybe insert a couple of leading underscores into the hashed
> class name so that a user would have to do something really illegal
> (i.e. make up a class name with two leading underscores) to get a
> collision?

I think it's easier to do the opposite: Make sure the plain-text
string contains a character which cannot appear in the hash string
(which is in hex: 0-9, A-F). Let's take the underscore (a single one
is sufficient), since we already have that in most cases. I have
modified the patch to make sure that it appears in *all* cases (cf.
get_unique_type_string). There you go, the improbable is now
impossible ;)

Another small change I made in 'gfc_hash_value' is to remove the
modulus. It only saved two digits in the mod file, but it increased
the probability of a hash collision.

Ok for trunk? (I'll do another regtest just to be on the safe side.)

Cheers,
Janus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr46971_v2.diff
Type: text/x-diff
Size: 5770 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101230/1a61ee83/attachment.bin>


More information about the Gcc-patches mailing list