NO

Author Topic: Access violation error  (Read 4518 times)

sal55

  • Guest
Access violation error
« on: September 24, 2014, 11:27:48 AM »
I get this error:

<filename>(15682): fatal error: Internal error: 'Access violation' at 0x0048049c.

when trying to compile this large code: http://pastebin.com/exALGqBt

This is using the 32-bit Pelles C compiler, and with optimisation on (/Ot). It's OK without optimising, or with the 64-bit compiler. [Version 7.00.25]

Edited to add:

Command line used (via my own IDE) is:
\pec\bin\pocc.exe /IC:\pellesc\include /IC:\pellesc\include\win -Tx86-coff -Ze /Ot \pca1\pccone.c >errors.tmp

OS is Windows 7 64-bit on AMD Athlon II X2.

(Sorry I can't get it any smaller than this 18000-line file; it did originally appear in a 5000-line constituent module, but that has many untidy includes to go with it, and 6000 or so lines is still quite a lot.)

The error seems to be at the 'do_sqrt()' function it refers to; it goes away if line 15692 ('break; case tr64:') is commented out. It also goes away when that function is put into a standalone program.

(The 64-bit compiler doesn't have this problem, however: this particular program often stores addresses of variables and functions in 32-bit slots, but the 64-bit compiler seems to like sometimes assigning addresses above the 32-bit range, such 0x140014480, even though the total code and data is small, which cause other problems!)
« Last Edit: September 24, 2014, 02:58:17 PM by sal55 »

neo313

  • Guest
Re: Access violation error
« Reply #1 on: September 24, 2014, 11:49:15 AM »
wow

czerny

  • Guest
Re: Access violation error
« Reply #2 on: September 24, 2014, 03:06:46 PM »
A lot of warnings but no error, with

XP SP3 and Pelles C 8 RC4 32-Bit.

sal55

  • Guest
Re: Access violation error
« Reply #3 on: September 24, 2014, 09:17:51 PM »
A lot of warnings but no error, with

XP SP3 and Pelles C 8 RC4 32-Bit.

That's version 8? I didn't know there was one.

But I've tried that and the compiler error has disappeared. (A few things aren't quite right with the resulting code but I'll have to investigate that further as to whether it's a compiler issue.)

Thanks.
« Last Edit: September 24, 2014, 09:20:25 PM by sal55 »

neo313

  • Guest
Re: Access violation error
« Reply #4 on: September 25, 2014, 12:10:39 AM »
Did you write that code or is it a disassembly/automatically generated?


I also noticed you are taking addresses of labels( goto statements ), which is a gcc extension. I don't know if Pelles supports that, so you might have problems with it.
« Last Edit: September 25, 2014, 12:23:34 AM by neo313 »

sal55

  • Guest
Re: Access violation error
« Reply #5 on: September 25, 2014, 01:29:49 AM »
Did you write that code or is it a disassembly/automatically generated?
I used a script that combined separate C modules and headers into a single file; that stripped comments and put in some of the annotation.

But also some of the original was auto-generated (some of the data tables and auto-lists of function prototypes), while I like using alternate syntax for things like {...} blocks and that gets converted (resulting in a distinctive look to the C code).

(I have properly auto-generated code, from another language to C, and believe me you can tell! Mainly by massive numbers of extra parentheses.)

Quote
I also noticed you are taking addresses of labels( goto statements ), which is a gcc extension. I don't know if Pelles supports that, so you might have problems with it.

That's conditional code. There are four dispatch functions that can be selected, two of them are standard C. The label-pointer code needs gcc or Clang to compile it (and for this application, gives a bit of extra speed).

czerny

  • Guest
Re: Access violation error
« Reply #6 on: September 25, 2014, 10:51:05 AM »
(I have properly auto-generated code, from another language to C, ...
What language? What project source?

sal55

  • Guest
Re: Access violation error
« Reply #7 on: September 25, 2014, 12:03:19 PM »
(I have properly auto-generated code, from another language to C, ...
What language? What project source?

That was an unrelated project, where if I wrote in a source language (of my own design) something like:

repeat ... until not x

it would generate this C code:

L2:;
  do {
    ...
L3:;
  } while (!(!((bool)((u32)(x)))));
L4:;

I don't think anyone would be in any doubt as to whether this was written by a person, or auto-generated!