This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/52534] gcc doesn't detect incorrect expression in call to va_start


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52534

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-15 10:03:59 UTC ---
Because otherwise
void
foo (char a, ...)
{
  __builtin_va_list va;
  __builtin_va_start (va, a);
  __builtin_va_end (va);
}
would not work (arg there is (int) a, as char is promoted to int).
IMHO if we want to diagnose this, it should be done in the C/C++ FEs, e.g.
for C FE perhaps in c_parser_postfix_expression_after_primary, by requiring
that
the second argument to __builtin_va_start is an identifier token, rathern than
a + 0 or similar.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]