Thread: Compiler Error

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    45

    Compiler Error

    A number of the matrix programs I have written work correctly, computing the correct answers for more than half of a matrix, but then I get an error message than says:

    "Exiting due to signal SIGNOFP
    Coprocessor not available at eip=0001edf ...."

    and so on.

    What does this error message mean?

  2. #2
    Registered User
    Join Date
    Jun 2008
    Posts
    45
    Attachment 8212

    I attached a screen shot of the error message if that helps...

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It means you did something wrong in your program. Probably something undefined.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Apart from figuring out that your compiler is DJGPP, there's not a lot I could suggest.

    Since you have a cmd.exe, it means you're at least on NT, so I'm guessing that your processor is at least a pentium.

    Plus the fact that it works for a while and then throws this error. If this error appeared at all, it was usually on the first attempted use of a co-processor.

    Which brings us back to bugs in your code.

    Do you think you could produce a short example which you could post complete, and which throws this error?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Jun 2008
    Posts
    45
    I know I had it working before, but I don't recall changing anything that would affect the output. This is just a small segment of the code of a much larger program. Please let me know if you find any errors, however obvious they may be, that I cannot seem to find (or possibly don't know about).

    Code:
    #include<stdio.h>
    #include<math.h>
    
    float scenarioB(void);
    
    int size_PDP, size_PDP2, size_PPA, size_PPA2;
    
    float infoexploitation(float PDP_dB[size_PDP][size_PDP2], float 
    
    Power_per_angle_dB[size_PPA][size_PPA2]);
    
    
    int main(void)
    {
    	scenarioB();
    }
    
    
    float scenarioB(void)
    {
    
    size_PDP=2, size_PDP2=9, size_PPA=2, size_PPA2=9;
    
    float PDP_dB[2][9]= 
    
    {{0,-5.4287,-2.5162,-5.8905,-9.1603,-12.5105,-15.6126,-18.7147,-21.8168},
    		     
    
    {0,10e-9,20e-9,30e-9,40e-9,50e-9,60e-9,70e-9,80e-9}};
    
    
    float Power_per_angle_dB[2][9]= {{0, -5.4287, -10.8574, -16.2860, 
    
    -21.7147, -1e300, -1e300, -1e300, -1e300}, 
    {-1e300, -1e300, -3.2042, -6.3063, -9.4084, -12.5105,  -15.6126,  
    
    -18.7147,  -21.8168}};
    
    infoexploitation(PDP_dB, Power_per_angle_dB);
    
    	
    }
    
    
    
    float infoexploitation(float PDP_dB[size_PDP][size_PDP2], float 
    
    Power_per_angle_dB[size_PPA][size_PPA2])
    {
    
    	int i, j, k;
    
    	printf("\n\n******Information*********\n");
    
    	printf("\n\nPDP:\n");
    	for(i=0;i<size_PDP;i++)
    {	
    	for(j=0;j<size_PDP2;j++)
    {		printf("%e\t", PDP_dB[i][j]);
    	}
    	printf("\n");
    }
    
    
     /*----------PDP in linear values---------*/
    
    /*THIS IS THE PART OF THE PROGRAM THAT WORKS AND THEN CRASHES.  ACCORDING TO A SOURCE I FOUND...
    
    SIGNOFP
        The No Co-processor signal. Generated if a co-processor (floating-point) instruction is encountered when no co-processor is installed (Int 07h). */
    
        float PPA_linear[size_PDP][size_PDP2];
     	printf("\n\nPPA Linear:\n");
     	for(i=0; i<size_PDP; i++)
     	{
     		
     		for(j=0; j<size_PDP2; j++)
     		{	
     					
     		PPA_linear[i+1][j+1] = pow(10, 
    
    .1*Power_per_angle_dB[i][j]);
     		printf("%e\t", PPA_linear[i+1][j+1]);
     		}printf("\n");
     	} 
    
    
    return 0;
    }

    Thanks.

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Well, in the last double-for-loop at the bottom, you walk off the ends (both ends, i and j) of your array.

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    djgpp assumes that it's "alone" in the system, and it may well get confused by DOS not really being DOS and that Windows NT/2K/XP/Vista is actually managing the FP unit.

    Why not get the gcc-mingw compiler and use that to produce a native Windows application rather than a 32-bit DOS extension executable. I don't see anything in the code that should not work in gcc.

    Although I think the real problem is that you are using i+1 and j+1 in the infoexploitation function, and that goes outside the valid range of the variable.

    Code:
    float PPA_linear[size_PDP][size_PDP2];
    should be:
    Code:
    float PPA_linear[size_PDP+1][size_PDP2+1];
    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Some layout and indentation wouldn't hurt either.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  9. #9
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Salem View Post
    Some layout and indentation wouldn't hurt either.
    Sure, before I even tried to fix any other problem I did M->, M-<, C-x C-x, M-x indent-region in Emacs.

    And there are several warnings about not returning a value from functions in the original code too, if -Wall is used. Those should also be fixed. But I'll leave that to the OP to do.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  10. #10
    Registered User
    Join Date
    Jun 2008
    Posts
    45
    Thank you. The problem was that I looped past the values. For some reason, I thought that if I made the dimensions of the storing matrix [i+1][j+1], it would still work, the only difference being that instead of the first element being indexed as 0, it would be 1. I now see how that wouldn't work, but I'm still fairly new to programming. Sorry.

    As for the lack of layout and indentation, I apologize. I quickly just cut and paste the parts of the larger program. I didn't think to go back and fix it up. Sorry.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  2. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  3. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  4. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM