https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99001
Bug ID: 99001 Summary: indirect modification of function parameters Product: gcc Version: 7.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: wolfgang.roe...@gi-de.com Target Milestone: --- Hi, I would like to post a bug report for the GNU C/C++ compiler 7.5.0. We use the compiler to generate code for a PowerPC processor. Invokation line for the GNU C++ compiler: ccppc -c -x c++ --std=gnu++17 -Wall -Werror -g -mcpu=e6500 -m32 -maltivec -mvrsave -ftls-model=local-exec -msdata=sysv -fno-common -fno-openmp -mbig -mmultiple -mno-string -misel -mstrict-align -fverbose-asm -G 8 -O3 -I<some include paths> -D<some #define's> X.CPP -oX.O // file X.CPP struct X { X (int& r) : rr(r) {} ~X () { rr = 0; } int& rr; }; int f1 (int i) { { X x(i); } return i; } int f2 (int i) { X x(i); return i; } Wenn we compile this program the functions do the following: - function f1() returns 0 - independently of the value of parameter i; - function f2() returns the unmodified value of parameter i. I think that the behaviour of f2() is wrong and f2() should behave as function f1() does. With kind regards W. Roehrl