From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20947 invoked by alias); 13 Sep 2002 16:37:37 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 20915 invoked from network); 13 Sep 2002 16:37:36 -0000 Received: from unknown (HELO server2.pnicorp.com) (209.204.163.130) by sources.redhat.com with SMTP; 13 Sep 2002 16:37:36 -0000 Received: by server2 with Internet Mail Service (5.5.2655.55) id ; Fri, 13 Sep 2002 09:36:10 -0700 Message-ID: <30C1F709FEEBD511B11400B0D049495904B0AF@server2> From: John Gonzaga To: "'gcc-help@gcc.gnu.org'" Subject: pointer problem Date: Fri, 13 Sep 2002 09:37:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-SW-Source: 2002-09/txt/msg00104.txt.bz2 We just got our boot code running and I'm trying to make a simple C++ program. But here's my problem: #define REGBASE 0x3FF0000 #define IOPDATA (REGBASE+0x5008) // LED class class LED { public: LED( unsigned long * ); ... } ... in main // This code will not work unsigned long * ioport = ( unsigned long * )IOPDATA; LED * pLED = new LED( ioport ); // ... but this works! LED * pLED = new LED( ( unsigned long * )IOPDATA ); Looking at the dump for the code that doesn't work. unsigned long * ioport = ( unsigned long * )IOPDATA 10001d4: e3a03008 mov r3, #8 ; 0x08 10001d8: e28337ff add r3, r3, #66846720 ; 0x3fc0000 10001dc: e2833a35 add r3, r3, #217088 ; 0x35000 10001e0: e50b3030 str r3, [fp -#48] LED * pLED = new LED( ioport ); 10001e4: e3a00004 mov r0, #4 ; 0x4 10001e8: eb00022d bl 1000aa4 <__builtin_new> ... What happens if I set a breakpoint at 10001e4 is r3 will have a value of 0x3fc0008 which is 0x3ff5008 - 0x35000 but if I set a breakpoint at 10001d4 and step through until 10001e4, r3 will have 0x3ff5008. Then I hit go the program would run okay. Somehow address 10001dc gets ignored, any ideas. BTW, our target is a Samsung ARM7TDMI (S3C4530A). Thanks. John Gonzaga jgonzaga@pnicorp.com