Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#45 Compiler bombs out in gen.c

closed-out-of-date
Michael Hope
compiler (25)
5
2013-11-29
2000-09-21
Miguel Melo
No

This might be related to the other gen.c bug submitted by wiseguy586. I get

test.c(15):error *** FATAL Compiler Internal Error in file 'gen.c' line number '1104' : aopPut got offset > aop->size
Contact Author with source code

on gbdk-2.95-3. It happens in line '1082' in gbdk-2.95-3.

Here's the file

---

#include "TJ_Globals.h"

void TickElements(void)
{
int i;
UBYTE iElemIdx;
BYTE iIncX;
BYTE iIncY;

if \( \!\(iLevelTick % iLevelTickStep\) \)
\{
    for \(i = 1; i < ELEMENT\_DIR\_MAX; i++\) // OFFENDING LINE\!\!\!
    \{
        iElemIdx                = iElemDirList\[i\];

        switch \( i \)
        \{
        case ELEMENT\_DIR\_UP:
            iIncX               = 0;
            iIncY               = -1;
            break;

        case ELEMENT\_DIR\_DOWN:
            iIncX               = 0;
            iIncY               = +1;
            break;

        case ELEMENT\_DIR\_LEFT:
            iIncX               = -1;
            iIncY               = 0;
            break;

        case ELEMENT\_DIR\_RIGHT:
            iIncX               = +1;
            iIncY               = 0;
            break;
        \}

        while \( iElemIdx \!= NULL \)
        \{
            Elems\[iElemIdx\].iX    += iIncX;
            Elems\[iElemIdx\].iY    += iIncY;

            iElemIdx            = Elems\[iElemIdx\].iNext;
        \}
    \}
\}

}

---

If I comment out the switch, it compiles fine and if I change var 'i' to type tElementType (which is just an enum, that defines all those ELEMENT_DIR_* values) it also works fine.

Hope this helps...

Discussion

  • Michael Hope
    Michael Hope
    2000-09-30

    • assigned_to: nobody --> michaelh
     
  • The Following program (made as simple as possible) also generates the same error. It seems that 4 or
    more consecutive case statements cause the error. Commenting "case 1:" compiles fine. Also if
    number of case statements is more that 10 (or so) the compiler crashes. Hope this helps to
    nail this bug down. I am using version 2.95-3 in Win32 (both 98 and NT)

    #include <gb/gb.h>

    //-----------------------------------------------------------------------------------

    int f(int x)
    {

    switch(x) {
    case 1:
    case 2:
    case 3:
    case 4:
    return(30);

    } // end switch

    }

    void main(void)
    {

    f(10);

    }

     
  • Michael Hope
    Michael Hope
    2001-11-05

    Logged In: YES
    user_id=373

    This is a canned message in response to all of the pre 2.96 open
    bugs. Could you please try and reproduce this under 2.96? gbdk
    2.96 is available from the gbdk download page or from
    http://gbdk.sourceforge.net/staging.

     
  • Michael Hope
    Michael Hope
    2001-11-05

    • status: open --> closed-out-of-date