Frequently Seen Mistakes/Problems

  1. You get the correct results in grace, but not in the submit server - This may happen because:
    • You have uninitialized variables. Grace seems to set uninitialized variables to 0.
    • Your strings are missing a null character ('\0').
    • You are not declaring an array that is large enough.
    • When iterating over an array the code is going beyond the array memory area (e.g., off by one).
    • You are passing to a function a pointer to a character rather than a pointer to an array of characters.
  2. Inconsistent background retests in submit server error - When the submit server is not busy, it can run tests again. If the result generated for a test changes after running the test again you will see a number under the "# inconsistent background retests" column of your results in the submit server.
  3. Your code might be generating a segmentation fault (segfault) in the submit server if, for a test, the submit server displays a message along the lines:

    "expected ... but output ended".

  4. If you are missing a required function or has a typo in a function (e.g., prontf instead of printf) you may get a message similar to the following:

    "collect2: error: ld returned 1 exit status"

    ld represents the GNU linker (you can find additional information by executing "man ld".  Usually the last step in compiling a program is to run ld (this is done on your behalf by GCC).

  5. If your code is not compiling in the submit server it might be due to a function that is not implemented. Provide an empty body (with a dummy return value if needed) for functions you have not implemented yet so your code compiles in the submit server.
  6. You are returning a pointer to a local variable.
  7. Check your pointer variables are initialized correctly.
  8. You see the error "ISO C90 forbids mixed declarations and code [-Wpedantic]". The gcc alias for this class requires variables to be declared at the top of a block. The following code will generate the above error:
    		   int main() {
    		      printf("here\n");
                          int x;
    
                          return 0;
                       }
    	       
    To correct the error, make int x; the first statement in the block.
  9. If you get an error along the lines of "stack smashing" the problem could be you are writing to an area you not supposed to access (e.g., array out of bounds access).
  10. Using sizeof() incorrectly. For example, using sizeof() to determine the size of an array parameter. In this case sizeof() will return the number of bytes associated with a pointer type, not the number of elements in the array.
  11. Debugging information can be found at Debugging in C.
Web Accessibility