This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: get "stack smasshing" for code that uses pointers passed as references.
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: Wendell Nichols <wcn00 at shaw dot ca>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 23 Aug 2010 19:26:04 +0200
- Subject: Re: get "stack smasshing" for code that uses pointers passed as references.
- References: <4C72852C.3070201@shaw.ca>
* Wendell Nichols:
> I have some code that passes pointers like:
>
> int foo( int a,char *& word){
> ...
> }
>
> If that function modifies the actual pointer word (indexes it for
> instance) I will get a stack smashing error at runtime. The code runs
> perfectly if I set -fno-stack-protector.
>
> Is this feature intended to work properly with references?
Yes, it is. You should try to come up with a minimal example, so that
we can see if it is caused by your code or a compiler bug.