LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Advertise
  • Mirrors
  • Logos
  • Contact us
  • Find Resources
  • Job Opportunity
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Openrisc > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: vbaksa@n...
    Date: Fri, 2 May 2003 19:26:33 -0100
    Subject: [openrisc] GCC problem
    Top

    During debugging a RTOS kernel I discovered that following statement 
    caused the Link Address Register R9[LR] to be set to 0.  Because of this 
    kernel crashed. 
    RTOSTcbHigRdy = RTOSTcbPrioTbl[(y << 3) + RTOSUnMapTbl
    [RTOSRdyTbl[y]]];
    
    To avoid this problem and to make the kernel work I split the previous 
    statement to following 3 statements: 
        i = RTOSRdyTbl[y];
        t = (y << 3) + RTOSUnMapTbl[i];
        RTOSTCBHighRdy = RTOSTCBPrioTbl[t];
    
    Local variables and global arrays used in both cases are as follow:
        ULONG         y, t, i;                       // Locals
        ULONG         RTOSRdyTbl[];            // Global array
        ULONG         RTOSUnMapTbl[];        // Global array
        ULONG        *RTOSTCBPrioTbl[];      // Global array
    
    I used following compiler options to build the kernel:
        rtostest-O0.o: rtostest.c
             or32-uclinux-gcc -g -O0 $? -c -o $@
        rtostest-O2.o: rtostest.c
             or32-uclinux-gcc -g -O2 $? -c -o $@
    
    I believe that cause of the problem is how the gcc compiler handles 
    multiple array indexing.  
    Would you look at this problem and suggest which compiler option to use 
    to avoid this kind of problems in the future.
    
    Thank you,
    Venko Baksa
    Nimbus Wireless Inc.
     
    
    
    

    Follow upAuthor
    Re: [openrisc] GCC problemMatjaz Breskvar

     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.