Results of gcc -v -save-temps all-your-options source-file: gcc -v -save-temps all-your-options SampleExam1.cpp gcc: all-your-options: No such file or directory Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-54) /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/cpp0 -lang-c++ -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=3 -D__GNUC_RH_RELEASE__=54 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ SampleExam1.cpp SampleExam1.ii GNU CPP version 3.2.3 20030502 (Red Hat Linux 3.2.3-54) (cpplib) (i386 Linux/ELF) ignoring nonexistent directory "/usr/i386-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/include/c++/3.2.3 /usr/include/c++/3.2.3/i386-redhat-linux /usr/include/c++/3.2.3/backward /usr/local/include /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/include /usr/include End of search list. /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/cc1plus -fpreprocessed SampleExam1.ii -quiet -dumpbase SampleExam1.cpp -version -o SampleExam1.s GNU CPP version 3.2.3 20030502 (Red Hat Linux 3.2.3-54) (cpplib) (i386 Linux/ELF) GNU C++ version 3.2.3 20030502 (Red Hat Linux 3.2.3-54) (i386-redhat-linux) compiled by GNU C version 3.2.3 20030502 (Red Hat Linux 3.2.3-54). as -V -Qy -o SampleExam1.o SampleExam1.s GNU assembler version 2.14.90.0.4 (i386-redhat-linux) using BFD version 2.14.90.0.4 20030523
I cannot figure out how to attach the source file here, but if you need it, please let me know. Suppose a program contains the function double f1(double x_par, double y_par, double& z_par) { // I have simplified the function operation here to avoid writing too many // unnecessary lines of code. x_par = 3; y_par = 1; z_par = x_par + y_par; return(z_par); } In main, I have the code: double x = 8, y = 3, z = 1; cout << f(x, y, z) << " " << x << y << z << endl; cout << x << y << z << endl; Given that z is a reference parameter, we would expect the output 4 834 834 but the actual output is 4 831 834 For some reason, the compiler is not recognizing the change to the reference argument in that first line of code. Thank you for your time. -- Summary: g++ compiler: incorrect handling of reference parameters Product: gcc Version: 3.2.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ramiller at mines dot edu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26820