Exception: Segment Violation

  • Permalink
  • submit to reddit
  • Email
  • Follow


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

See related articles to this posting


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
comp.compilers.lcc 1245 articles. 0 followers. Post

1 Replies
718 Views

Similar Articles

[PageSpeed] 14


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

segmentation violation
i am using a mex file which is working perfectly fine before conversion of my C/C++ structure the mxarray* ouputs trying to do this conversion i have got many problems i have tried all possibilities but unfortunately without success i have used valgrind for debugging but it does not really help me i will be very grateful if any one can help me i will give only the relevant part of code any unclear issues just ask me for more details typedef struct port_description { int portnb; ///< port number std::string protocol;///< protocol name float throughput;///< throughput /*...

a Segmentation violation
this is my mdlInitializeSizes function.it cause a Segmentation violation . what's wrong with me? static void mdlInitializeSizes(SimStruct *S) { int_T ParamsCount=ssGetSFcnParamsCount(S); if(ParamsCount != 0) { ssSetErrorStatus(S, "Mismatching parameter to S-function"); return; } ssSetNumContStates(S, 0); ssSetNumDiscStates(S, 0); if (!ssSetNumInputPorts(S, INPUT_NUMBER)) return; if (!ssSetNumOutputPorts(S, 1)) return; ssSetOutputPortWidth(S, 0, 1); ssSetInputPortWidth(S, 0, 1); ssSetInputPortWidth(S, 1, 1); ...

segment violation
i am getting segment violation error repeatedly while working with MATLAB 6.5. My work is halted.. how to solve this probleb. my system config is AMD XP 1.8 GHz, 256 MB RAM, Windows 2000 . "S K gupta" <skg8888@hotmail.com> wrote in message news:eee21b2.-1@webx.raydaftYaTP... > i am getting segment violation error repeatedly while working with > MATLAB 6.5. My work is halted.. how to solve this probleb. my system > config is AMD XP 1.8 GHz, 256 MB RAM, Windows 2000 . Are you using a mex file? What output do you get? When does this problem occur? Without more informat...

Segmentation violation.
Hello, I have been using Simulink quite a while untill a few days ago... eversince I encountered a runtime error followed by segmenation violation, I am unable to launch MATLAB. I have tried reinstalling the MATLAB but to no use. Help would be appreciated ASAP. Thank you. Runtime Error! Program: C:\MATLAB\bin\win32\MATLAB.exe This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. ---------------------------------------------------------------------- -- Segmentation violation detected at ...

[ace-bugs] ACE_Service_Config::close() exception: Unhandled exception in test.exe (ACED.DLL): 0xC0000005:Access Violation
This is a multi-part message in MIME format. ------_=_NextPart_001_01C6A5D2.D5EEBB74 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable ACE VERSION: 5.5 =20 HOST MACHINE and OPERATING SYSTEM: Windows XP service pack1=20 =20 DOES THE PROBLEM AFFECT: COMPILATION? LINKING? On Unix systems, did you run make realclean first? EXECUTION? OTHER (please specify)? EXECUTION =20 SYNOPSIS: ACE_Service_Config::close() has exception: =20 Unhandled ...

"out of memory" error message and "segment violation" or "segmentation fault (on linux)": the partially solution
Dear all, try these solution (origin support matlab): type the command line at the top of your .m file: feature accel off You can type the same at prompt matlab. If you are lucky, the message diseppaers. Type feature accel on for toggle (on is the default mode). Alain, who as very big experience with "out of memory and segmentation fault" ...

exception access violation
Hi, I am compiling a program with gnat gps and I am receiving an access violation error. And my program crashes at this point. Exception raised >>> Exception Name => PROGRAM_ERROR >>> Exception Message => EXCEPTION_ACCESS_VIOLATION Does anyone know what this could mean? Thanks, jade On Mon, 2006-11-13 at 11:31 -0800, Jade wrote: > Hi, > I am compiling a program with gnat gps and I am receiving an access > violation error. And my program crashes at this point. > > Exception raised > >>> Exception Name => PROGRA...

Segmentation violation detected
I am using Windows xp in office, all my codes are working fine but when i run same code in Windows 2007 it showing "Segmentation violation detected ". Following msa also displays. Stack Trace: [0] m_interpreter.dll:public: virtual void __thiscall FunctionHandleWorkspaceCI::customLoad(class mcos::COSInterfacePtr,class mcos::COSValue,class mcos::COSDataTypePtr)(0x01d6fe40, 0x01db8510, 0x01d9a0d0, 5) + 401 bytes [1] mcos.dll:public: virtual void __thiscall mcos::COSClassI::customLoad(class mcos::COSInterfacePtr,class mcos::COSValue,class mcos::COSDataTypePtr)(0x01d6fe40, 0x01db8...

mxCreateNumericArray segmentation violation
Hello, I am attempting to use mxCreateNumericArray. When I use mxCreateNumericMatrix there are no issues. When I use mxCreateNumericArray for the same purpose a segmentation violation occurs. Any help would be greatly appreciated. Thanks, Nate Here is a simple example that reproduces the error: ************MODULE FILE************ module mexf90 interface function mxClassIDFromClassName(classname) character :: classname integer*8 :: mxClassIDFromClassName end function mxClassIDFromClassName function mxGetPr(pm) integer*8,pointer :: mxGetPr ...

Segmentation violation #11
Hi all, I encountered a problem that when I called my C++ code from Matlab, it will cause Segmentation violation error and shut down itself. However, this was not happened every time. sometimes I run the program, it worked well but sometimes it would cause fault. In addition, the program runed well with small data but not large data set.Can anyone kindly help me with this problem? Thanks very much. This is a really important project for me. I attached my MATLAB code here: clear data=load('testdata1.txt'); dx=1; dy=dx; points=5; %search_radius = sqrt(2).*dx; %define the searc...

Segmentation violation error
Hi All, I am working with GUI with webcam application,there is no problem except the time I close the GUI.My Quit function is: 1------------------------ global vidL stoppreview(vidL); delete(handles.figure1); stop(vidL); wait(vidL); delete(vidL); clear vidL; 1----------------------- and that is segmentation violation error report: 2----------------------- Configuration: MATLAB Version: 7.0.4.365 (R14) Service Pack 2 MATLAB License: 161051 Operating System: Microsoft Windows XP Window System: Version 5.1 (Build 2600: Service Pack 2) Processor ID: x86 Family 15 Model 3 Step...

Segmentation Violation Problem
Has any one seen this segmentaion violation before. =20 Segmentation Violation In Task [ DATASTEP ] =20 Fault Occured at [bcopy+0+94] =20 bcopy+0+94 dsxxexc+0+38 -- bridge stub _uc_trampoline+0+0xfffffffffffffffc =20 =20 The program use to run perfectly fine until this year when we moved to 9.1.3 on our Unix Box. I am wondering if it has something to do with the ODS statements sending the output back to the web user. =20 Toby Dunn =20 "It's OK to figure out murder mysteries, but you shouldn't need to figure out code. You should be able to read it." -Steve C McConnell =20 T...

Segmentation Violation #6
I'm working on a program for biomechanical simulations. We made some changes to increase efficiency, but I am encountering a segmentation violation on a S-function that I haven't been able to figure out yet. I would very much appreciate your help on solving this. The error is occuring right after the 'message("1");' line in this code: "if(musclesexist) { for (i=0; i<sdm->num_muscles; i++) { ms = &sdm->muscles[i]; message("1"); ms->muscle_tendon_length = calc_muscle_tendon_l...

Restart on segmentation violation
I have a buggy code that causes a segmentation violation often. I want to be able to (obviously automatically, without any manual intervention) simply close matlab and restart it when this occurs. This seems like a fairly common thing to want to do, but i dont know how to do it. Does anyone know how? > I have a buggy code that causes a segmentation violation often. I > want to be able to (obviously automatically, without any manual > intervention) simply close matlab and restart it when this occurs. > This seems like a fairly common thing to want to do, but i dont > know > h...

Segmentation violation #8
Hi, I'm trying to use a C++ dll, that I created where there are all matrix operations that I need, as transpose, inversion, expm, etc..., and I can output the information using mexPrintf, etc... Now the problem is, when I try to run it, there are times where I got the following error, and I don't know why (see error below). With a C++ program I can debug and check that there is no problems inside my code. Maybe it's a Matlab threading problem. Thank you very much for any kind of help. MATLAB crash file:C:\DOCUME~1\S15_2_2\LOCALS~1\Temp\matlab_crash_dump.2204 --------------------...

how to fix segmentation violation
I had mex function that was running well. Then i had to do small modification in the C subroutine which is called by mex gateway function. since the input and output parameters remained same, i didn't change anything in mex function. This new mexfunction compiles with no error but when i tried to call this mexfunction from matlab it gives segmentation violation and crashes. I would appreciate for your suggestion about possibilities for these kinds of error and how to fix it. Here is the crash report. Register State: EAX = 00000000 EBX = 7c38b548 ECX = 7c34f797 EDX = 01206f2...

Segmentation Violation #4
Hi, I have been trying to read an avi file and subsequently create frame images from the same movie file. Instead of trying to read the whole file into matlab, I decided to read a single frame each time and create a frame image. I have been getting a segmentaion violation message each time I try to run the script and this happens towards the end of the analysis. The following is what the message looks like : This error was detected while a MEX-file was running. If the MEX-file is not an official MathWorks function, please examine its source code for errors. Please consult the External In...

Segmentation violation #9
I have this problem when used the OmniDriverSPAM32.dll to Osean Optics spectrometers, i donn't know if a matlab problem or a dll problem, some one help me? ------------------------------------------------------------------------ Segmentation violation detected at Wed Jul 15 10:59:59 2009 ------------------------------------------------------------------------ Configuration: MATLAB Version: 7.5.0.342 (R2007b) MATLAB License: 161052 Operating System: Microsoft Windows XP Window System: Version 5.1 (Build 2600: Service Pack 3) Processor ID: x86 Family 15 Model 1...

Segmentation violation help
For Matlab versions 7.1 and 7.2 I continually crash with the same segmentation violation. Does anyone know how to fix this problem? Operating System: Microsoft Windows XP Window System: Version 5.1 (Build 2600: Service Pack 2) Processor ID: x86 Family 6 Model 6 Stepping 2, AuthenticAMD Virtual Machine: Java 1.5.0 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode Default Charset: windows-1252 Register State: EAX = 10fbe5e0 EBX = 51718cf2 ECX = 51711592 EDX = 51720452 ESI = 51727bb2 EDI = 00000000 EBP = 00d0b20c ESP = 00d0b1b4 EIP = 7ad1e466 FLG = 00010206 S...

getting Segmentation Violation
hello all, I am developing a lisp application which analyzes the source code. During analysis it creates many objects using make-instance. The problem is ....the program consumes available memory and PF usage reaches to 1.90 GB and program emits an exception 'Segmentation violation: error no 11' To optimize it, I am now using secondary storage to dump the intermediate objects and retrieving them back whenever required. But still...I am not getting rid of the problem(even though many make- instance are removed). So ... can anyone help me. or atleast some pointers towards memory mod...

Segmentation Violation #5
Dear All, I have tried to generate a report from Simulink but I came across a crash report or segmentation violation. What is segmentation violation ? Regards, Kuldeep Kulkarni kuldeep kulkarni wrote: > Dear All, > > I have tried to generate a report from Simulink but I came across a > crash report or segmentation violation. > > What is segmentation violation ? > > Regards, > > Kuldeep Kulkarni usually means that some code tried to access memory (usually writing to it) where it shouldn't. do you run any self-written mex-files in the report? if so, ...

Segmentation Violation #3
Hello, I got a Segmentation Violation when calling a DLL from Matlab and also using libpointer command. What is going on? Thanks, Miguel ...

segment violation #2
i am getting segment violation error repeatedly while working with MATLAB 6.5. My work is halted.. how to solve this probleb. my system config is AMD XP 1.8 GHz, 256 MB RAM, Windows 2000 . ...

Segmentation violation #2
Hi, What does the following mean? Thanks sharma ---------------------------------------------------------------------- -- Segmentation violation detected at Wed Aug 04 18:05:42 2004 ---------------------------------------------------------------------- -- Configuration: MATLAB Version: 6.5.1.199709 (R13) Service Pack 1 Operating System: Microsoft Windows XP Window System: Version 5.1 (Build 2600: Service Pack 1) Processor ID: x86 Family 15 Model 2 Stepping 9, GenuineIntel Virtual Machine: Java 1.3.1_01 with Sun Microsystems Inc. Java HotSpot(TM) Client VM (mixed mode) R...