Antwort: [gcc-in-cxx] Don't pass enum types to va_arg
Ian Lance Taylor
iant@google.com
Tue Feb 3 18:27:00 GMT 2009
Markus Milleder <markus.milleder@generali.at> writes:
>> Index: builtins.c
>> ===================================================================
>> --- builtins.c (revision 143890)
>> +++ builtins.c (working copy)
>> @@ -11063,7 +11063,7 @@ validate_arg (const_tree arg, enum tree_
>> bool
>> validate_gimple_arglist (const_gimple call, ...)
>> {
>> - enum tree_code code;
>> + int code;
>> bool res = 0;
>> va_list ap;
>> const_tree arg;
>> @@ -11074,8 +11074,8 @@ validate_gimple_arglist (const_gimple ca
>>
>> do
>> {
>> - code = va_arg (ap, enum tree_code);
>> - switch (code)
>> + code = va_arg (ap, int);
>> + switch ((enum tree_code) code)
>> {
>> case 0:
>
> Shouldn't this be
> case ERROR_MARK:
> ? After all, you've just casted code to the enum type, adn ISTM that 0 is ERROR_MARK.
Yes, it should be. This is an existing oddity--the switch was on enum
tree_code both before and after my change. I'm only fixing cases
which need to be fixed for C++, not doing a general cleanup.
Ian
More information about the Gcc-patches
mailing list