|
|
Exception: Segment Violation
Hi,
/*--main.c--[begin]--*/
#include <stddef.h> /* NULL */
#include <stdlib.h> /* EXIT_SUCCESS */
typedef struct
{
struct {int value;} size;
int count;
} mystruct_t;
int test(mystruct_t * ms)
{
int result = 0;
if (ms != NULL)
{
result = ms->count;
}
return result;
}
int main(void)
{
test(NULL);
return EXIT_SUCCESS;
}
/*--main.c--[end]--*/
> lcc -O -c main.c
> lcclnk -subsystem console main.obj -o main.exe
> main.exe
(program crash)
program crash ONLY with option -O or -unused.
> lcc -v
Logiciels/Informatique lcc-win32 version 3.8. Compilation date: Apr 6
2010 13:15:36
Regards
--
Maciek
|
|
0
|
|
|
|
Reply
|
MaciekL
|
4/17/2010 9:17:32 AM |
|
Thanks for your bug report
With optimizations ON, lcc would generate a conditional move
instruction (cmovne). Apparently, that instruction will access the memory
ANYWAY even if the condition is FALSE.
This is a big mistake from my part.
I fixed this. Thanks for your (very good) bug report.
jacob
|
|
0
|
|
|
|
Reply
|
jacob
|
4/17/2010 4:58:13 PM
|
|
|
1 Replies
526 Views
(page loaded in 0.032 seconds)
Similiar Articles: Exception: Segment Violation - comp.compilers.lccHi, /*--main.c--[begin]--*/ #include /* NULL */ #include /* EXIT_SUCCESS */ typedef struct { struct {int value;} size; int count; } mystruct_t;... Application Code Error causing Access Violation HELP!!!! - comp ...Exception: Segment Violation - comp.compilers.lcc Need help in deciphering the crash dump ... Access violation exception p[i] = 13; // causes an access violation ... segmentation violation detected Matlab 2009b - comp.soft-sys ...It gives "Segmentation Violation Detected" Error. Setup: (1) I have Snow ... Exception: Segment Violation - comp.compilers.lcc segmentation violation detected Matlab ... sum of segment size and executable size - comp.unix.programmer ...Exception: Segment Violation - comp.compilers.lcc Hi, /*--main.c--[begin]--*/ #include /* NULL */ #include /* EXIT_SUCCESS */ typedef struct { struct {int value;} size ... Raised lettering - comp.graphics.apps.gimpException: Segment Violation - comp.compilers.lcc Segmentation violation - C - Jobs, interviews, CV, cover letter ... A segmentation violation usually indicates an attempt ... C++: PTHREAD_CANCEL_ASYNCHRONOUS and random crash - comp ...Exception: Segment Violation - comp.compilers.lcc Hi, /*--main.c--[begin]--*/ #include <stddef.h ... console main.obj -o main.exe > main.exe (program crash ... top 10 uses ... Updates to lcc-win32 - comp.compilers.lccException: Segment Violation - comp.compilers.lcc > lcc -v Logiciels/Informatique lcc-win32 version 3.8. Compilation date: Apr 6 2010 13 ... monthly Last-modified: 2008/10 ... FAR CALL/JMP to an absolute address - comp.lang.asm.x86In other words is the Segment Selector part of the address? And if yes, what is ... the address of the >hook function. > >Not surprisingly, I got an Access violation exception. Converting goasm code to masm - comp.lang.asm.x86... A0 =A0 =A0 assume =A0fs: @data > > In 32-bit code, MASM sets the segment ... be redirected to SafeOffset XOR EAX,EAX MOV DWORD PTR [EAX], EAX ;Exception Access Violation ... Help on "Bus Error(coredump)" - comp.unix.programmerMaking an exception for this type would be unjustified, IMHO. If you wanted ... Segmentation violation was the error I was getting when I ... Help on "Bus Error(coredump ... Exception: Segment Violation - comp.compilers.lcc | Computer GroupHi, /*--main.c--[begin]--*/ #include /* NULL */ #include /* EXIT_SUCCESS */ typedef struct { struct {int value;} size; int count; } mystruct_t;... what causes a segmentation violationComment on what causes a segmentation violation Re: what causes a segmentation violation ... may have overwritten code, though this may result in a different exception to ... 7/26/2012 6:15:22 PM
|
|
|
|
|
|
|
|
|