[Bug c++/17891] New: An expression accepted as lvalue by compiler but not assigned at run time

k dot karamazen at trinite dot nl gcc-bugzilla@gcc.gnu.org
Fri Oct 8 11:01:00 GMT 2004


//  g++ -g -Wall nB2.cpp
//  ./a.aut
#include<stdio.h>
static void f1(void* &x)
{
  x=(void*)1;
}
int main(int , const  char **)
{ 
  int* a=(int*)2;
  f1((void*)a);
  printf("\n%p\n",a);//expected 0x1, got 0x2, no compiler error
  return 1;
}

//g++ --version
//g++ (GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7)

-- 
           Summary: An expression accepted as lvalue by compiler but not
                    assigned at run time
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: k dot karamazen at trinite dot nl
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17891



More information about the Gcc-bugs mailing list