• C

Help : Cannot understand error mesg.

Hello,
      I have written a C program to build the tables
that an assembler usually does. After compiling and trying
to run the program, an error message is displayed :

General Protection Exception
0xf8DF:0x0D12
SYS1A(1) 0x58DF:0X0D12 Processor Fault

I would really appreciate it if someone could tell me
whats going on ? What kind of error message is this and
where do I need to look ? The message gives me no idea of
where do I start looking for a problem.
I will summarize.

Waiting for a response.
Thanks.
Jeetandra
jmahtaniAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jackie071497Commented:
You should tell us about your OS : DOS or Windows?

General Protection Exception is always caused by illegal memory access.
In my experiences, you can start by following :
1. Check memcpy(), memmove(), ...
These function calls use buffer address as parameters.
Check the address whether it is where you want.
2. Mark some sources by using /* */
If the General Protection Exception disappear, then you can sure
that it is caused by the sources been marked. Reduce the range of
marked sources, until you can focus on some lines.

Good luck!

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jmahtaniAuthor Commented:
Hello,
     Thanks for replying. I believe the error is being caused due to an array that is of 68 by 48. When I cut the array size from 68 by 48 to 37 by 48( and commented the rest), I did not get the error. Then I decided to cut the 68 by 48 array to two arrays - 37 by 48 and 31 by 48, but then the error message came back. Do you have any idea of whats going wrong ?
( Note : In one of the initialisations of my array, I have one of the          rows as
         "         DC    C'BANANA    ,           ,KIWI   '",
  Can this be causing the problem.        

  If its not a problem to you, should I email my program to you,   so that it will give you a better idea of how the array is   being  initialised.
)
Waiting for your response.
Jeetandra.
0
cphCommented:
You should post the part causing problem as it could be different reason like you access a memory allocation where you shouldn't or you try to free a pointer which point anywhere....

CpH
0
The Five Tenets of the Most Secure Backup

Data loss can hit a business in any number of ways. In reality, companies should expect to lose data at some point. The challenge is having a plan to recover from such an event.

Jackie071497Commented:
You can e-mail me : sigmafei@ms1.hinet.net

But I think your better way is to post up some parts of your
initializations here. Maybe other friends also feel interested
for your coding problems.

0
jmahtaniAuthor Commented:
Hello,
     I really appreciate your help. The following is the declaration of the array that I believe is causing the problem,since when I reduced the size of the array from 68 rows to 37, the error disappeared. When I split the 68 rows array into 2 arrays of 37 and 31 rows, the error came back. If its not a problem,, can someone please examine it and let me know of what could be causing the problem.
Waiting for your response.
Jeetandra
char code[68][48]=
 {"DIFF     CSECT                             ",
  "         STM   14,12,12(13)                       ",
  "         BALR  12,0                               ",
  "         USING *,12                               ",
  "         ST    13,MAINSAV+4                  ",
  "         LA    13,MAINSAV                       ",
  "         LA    2,TABLE1                       ",
  "         LA    3,TABLE2                         ",
  "         LA    4,0                                  ",
  "NEXT     CLI   0(2),C' '                         ",
  "         BC    B'1000',GETNEXT                     ",
  "         CLC   0(10,2),=CL10'NOMORE'               ",
  "         BC    B'1000',NOMORE                   ",
  "         MVC   0(10,3),0(2)                          ",
  "         LA    4,1(4)                             ",
  "         LA    3,10(3)                           ",
  "GETNEXT  LA    2,10(2)                          ",
  "         BC    B'1111',NEXT                     ",
  "NOMORE   ST    4,COUNT                          ",
  "         LA    1,=A(PARMLT)                     ",
  "         LA    15,SORT                          ",
  "         BALR  14,15                               ",
  "         L     13,MAINSAVE+4                       ",
  "         LM    14,12,12(13)                         ",
  "         R     14                                   ",
  "         LTORG                                  ",
  "PARMLT   DC    A(TABLE2)                          ",
  "         DC    X'80',AL3(COUNT)                   ",
  "MAINSAVE DS    18F                                ",
  "COUNT    DS    F                                ",
  "TABLE1   DC    C'APPLE   ,PEAR       ,         '",
  "         DC    C'BANANA  ,           ,KIWI     '",
  "         DC    C'        ,RAMBUTAN   ,DATE     '",
  "         DC    C'GRAPE   ,BERRY      ,DURIAN   '",
  "         DC    C'KUMQUAT ,POMEGRANIT ,PAPAYA   '",
  "         DC    C'QUINCE  ,           ,NOMORE   '",
  "TABLE2   DS    15CL10                           ",
  "SORT     CSECT                           ",
  "          STM   14,12,12(13)                     ",
  "         BALR  12,0                           ",
  "         USING *,12                             ",
  "         ST    13,SORTSAVE+4                        ",
  "          LA    13,SORTSAVE                     ",
  "           L     2,4(1)                     ",
  "              L     2,0(2)                     ",
  "         L     5,0(2)                     ",
  "         BCTR  2,0                           ",
  "DO10     EQU   *                           ",
  "          LR    3,2                           ",
  "         SR    4,4                           ",
  "DO20     EQU   *                           ",
  "          L     6,0(4,5)                     ",
  "IF30     C     6,10(6)                     ",
  "         BNH   FI30                           ",
  "         MVC   TEMP(10),10(6)                     ",
  "         MVC   10(10,6),0(6)                     ",
  "         MVC   0(10,6),TEMP                     ",
  "FI30     EQU   *                           ",
  "         LA    4,10(4)                     ",
  "         BCT   3,DO20                     ",
  "0D20     EQU   *                           ",
  "         BCT   2,DO10                            ",
  "0D10     EQU   *                                ",
  "         L     13,SORTSAVE+4                     ",
  "         LM    14,12,12,(13)                     ",
  "         BR    14                               ",
  "TEMP     DS    CL10                             ",
  "         END   DIFF                           "};

0
wpintoCommented:
Make sure that you are not trying to access code[68] anywhere in your program. Since 'C' language is zero based valid values are code[0] to code[67].

for(i=0; i<=68; i++) is wrong; it should be for(i=0; i<68; i++)
0
jmahtaniAuthor Commented:
I am not trying to access row 68 anywhere in my program. The error seems to be associated with the declaration of the array since when I reduced the array size from 68 rows to 37 rows, I did not get the error message. So I decided to split the original array of 68 rows into two arrays of 37 rows and 31 rows, but then  the error message came back, which is surprising.
Waiting for a response.
Jeetandra.  

0
Jackie071497Commented:
I felt strange in your dim declaration : char code[68][48]= ...
Your data type is only 68 "pointers", so you need to define : char *code[68]=...

Could you show us how do you accessing code[n]?

0
jmahtaniAuthor Commented:
Dear Jackie and everyone who helped,
Thank you very much.
 char *code[68]=.... solved the problem.
Though the problem has been solved, can someone please
explain why char code[68][48] did not work, but
 char *code[68]=.. worked. I was under the impression
 that since my array consists of 68 rows and each row
consists of 48 columns, shouldn't char code[68][48]=...
work ??
Jeetandra
0
Jackie071497Commented:
*a = "1", a is a pointer. ( maybe 4 byte )
a = '1', a is a character buffer. ( 1 byte )

If you want to define code[68][48], you should use :
code[68][48] =
{ {'D','I','F','F',...}
  {'S','T','M',...}
  ...
}

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.