This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: module level flags
Gabriel Dos Reis wrote:
> | If the standard says otherwise, then this construct:
> |
> | (mumble*)&stumble
> |
> | where 'stumble' is not of type 'mumble' must be deemed a
> | hard error.
>
> Not necessarily. The C abstract machine has a notion of "effective
> type" and "compatible type".
By golly, YYSTYPE darn well better be compatible with
arbitrary pointers or there are real problems.
> It is dereferencing
> the resulting pointer that could be deemed an error if stumble isn't
> really a mumble nor of type compatible with mumble.
That's why I went on to say,
> Of course, what is particularly obnoxious about [this]
> circumstance is that the object that triggered the issue
> is a YYSTYPE. This is a YACC/Bison anonymous bucket. It is
> specifically intended that it be recast as a scalar or a
> pointer to arbitrary objects. Perhaps most of the real world
> problems would be solved by adding ``intptr_t'' and ``uintptr_t''
> to the list of ``void*'' and ``char*'' types that can be
> aliased by pointers to arbitrary things.