[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Moritz Grimm: Wondering about -Wstack-protector
- To: misc_(_at_)_openbsd_(_dot_)_org
- Subject: Re: Moritz Grimm: Wondering about -Wstack-protector
- From: Hiroaki Etoh <ETOH_(_at_)_jp_(_dot_)_ibm_(_dot_)_com>
- Date: Fri, 8 Apr 2005 10:42:18 +0900
- Cc: Theo de Raadt <deraadt_(_at_)_cvs_(_dot_)_openbsd_(_dot_)_org>
> To: misc_(_at_)_openbsd_(_dot_)_org
> Subject: Wondering about -Wstack-protector
>
> Hi,
>
> there is something that I don't understand about Propolice and
> - -Wstack-protector in gcc or g++.
>
> When compiling the following program
>
> $ cat test.c
> int main(void) {return(0);}
> $
>
> I get:
>
> $ gcc -Wstack-protector -o test test.c
> test.c: In function `main':
> test.c:1: warning: not protecting variables: it has a variable length
buffer
> $
>
> Whenever I use -Wstack-protector I get this warning, and the line it
> occurs in is always the one with the final `}' of the main() function.
>
> What does this mean, i.e. how bogus is this warning? I hope it's still
> doing its Propolice job, but I have to say, this is somewhat confusing.
>
>
> Moritz
I understand gcc generates several extra instructions and data when it
finds "main" function. There may be a variable length buffer in them. I
tried to remove the warning, but I can't distinguish the variable from a
user-written variable at the RTL level.
Hiroaki Etoh
Visit your host, monkey.org