Help : Cannot understand error mesg.

Posted on 1997-11-12
Last Modified: 2010-04-15
      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
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.
Question by:jmahtani

Accepted Solution

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!


Author Comment

ID: 1256289
     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.

Expert Comment

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....


Expert Comment

ID: 1256291
You can e-mail me :

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.


Author Comment

ID: 1256292
     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.
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                           "};

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.


Expert Comment

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++)

Author Comment

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.


Expert Comment

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]?


Author Comment

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 ??

Expert Comment

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',...}


Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 ( 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 recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

910 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

22 Experts available now in Live!

Get 1:1 Help Now