Solved

Help : Cannot understand error mesg.

Posted on 1997-11-12
10
171 Views
Last Modified: 2010-04-15
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
0
Comment
Question by:jmahtani
10 Comments
 
LVL 3

Accepted Solution

by:
Jackie071497 earned 50 total points
ID: 1256288
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
 

Author Comment

by:jmahtani
ID: 1256289
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
 
LVL 1

Expert Comment

by:cph
ID: 1256290
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
 
LVL 3

Expert Comment

by:Jackie071497
ID: 1256291
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
 

Author Comment

by:jmahtani
ID: 1256292
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 2

Expert Comment

by:wpinto
ID: 1256293
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
 

Author Comment

by:jmahtani
ID: 1256294
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
 
LVL 3

Expert Comment

by:Jackie071497
ID: 1256295
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
 

Author Comment

by:jmahtani
ID: 1256296
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
 
LVL 3

Expert Comment

by:Jackie071497
ID: 1256297
*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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now