[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

data/variant.hh relies on undefined behaviour

From: Thomas Jahns
Subject: data/variant.hh relies on undefined behaviour
Date: Wed, 12 Mar 2014 14:54:54 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10


I'm trying to build bison-3.0.2 on IBM AIX 6.1 with xlc/xlC (I've also
tried later versions) but I'm running into problems on "make check".

If I understand the code generated from variant.hh correctly it assumes that for

someClass a;

typeid(a).name() == typeid(a).name()

Because it stores the result of calling name() in the yytname_ member.
Unfortunately this assumption is incorrect and only

typeid(a) == typeid(a)

is strictly conformant. Which I wouldn't care about, but IBM xlC does generate
different results for calling name() and therefore the calc++ test fails on me.

Given the above I guess the cleanest solution would be to store the result of
typeid as yytname_ and use typeid((void *)0) or similar instead of YY_NULLPTR.
Asserting strcmp(yytname_, other.yytname_) == 0 instead of comparing the
pointers would probably also work.

Regards, Thomas
Thomas Jahns
DKRZ GmbH, Department: Application software

Deutsches Klimarechenzentrum
Bundesstra├če 45a
D-20146 Hamburg

Phone: +49-40-460094-151
Fax: +49-40-460094-270
Email: Thomas Jahns <address@hidden>

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]