This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Doing an abort for invalid va_arg type
- From: Corey Minyard <minyard at acm dot org>
- To: Geoff Keating <geoffk at geoffk dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 06 Jun 2003 17:31:24 -0500
- Subject: Re: Doing an abort for invalid va_arg type
- References: <3EE0C94C.6060506@acm.org> <jm65nix66b.fsf@desire.geoffk.org>
Geoff Keating wrote:
>Corey Minyard <minyard@acm.org> writes:
>
>
>
>>I'm working on a situation where the compiler is producing an
>>abort when passing a "char" into va_arg.
>>
>>I know that the code is invalid, but this involves legacy systems.
>>I would think it better to produce an error in this case, on the
>>principle that bugs are cheaper to fix the sooner you find them.
>>
>>
>
>The compiler used to do this, but it was pointed out that it's perfectly
>legal C to use this construct, so long as it never gets executed. Thus
>the abort.
>
>The compiler does always produce a warning.
>
I understand that it's legal and what the compiler does is legal.
However, legal and useful are not always the same thing :-).
What the compiler does now seems a little silly. If you are building a
system that requires reliable continuous operation, putting time-bombs
like this into your system is asking for trouble.
>
>...
>
>
>>If that isn't acceptable, what about adding a flag to cause an
>>error any time the compiler would produce an abort?
>>
>>
>
>Have you tried -Werror?
>
Unfortunately, there is a lot of legacy code, and cleaning up all the
error is not an option. I agree in principle, but I can't do it in this
case.
-Corey