f



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
MaciekL
4/17/2010 9:17:32 AM
comp.compilers.lcc 1279 articles. 0 followers. Post Follow

1 Replies
1164 Views

Similar Articles

[PageSpeed] 55

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
jacob
4/17/2010 4:58:13 PM
Reply:

Similar Artilces:

internal compiler error: Segmentation violation
test.c: In function `flush_thread': test.c:52: internal compiler error: Segmentation violation Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. /* test.c --------------------------------------------------------------------- --------- */ #define NULL ((void *)0) #define NR_TASKS 512 #define _set_tssldt_desc(n,addr,limit,type) \ __asm__ __volatile__ ("movw $" #limit ",%1\n\t" \ "movw %w0,%2\n\t" \ "rorl $16,%0\n\t" \ "movb %b0,%3\n\t" \ "movb $&...

Matlab Compiler 4 causing Segmentation Violation
I've been trying to compile a very basic .m file under 4.0 and keep getting the same error when trying to run the compiled .exe Below is the error message given when running the .exe. Below this is the message generated at compile-time. Anyone got any ideas? cheers David Opening log file: C:\DOCUME~1\DavidC\LOCALS~1\Temp\java.log.2188 ------------------------------------------------------------------------ Segmentation violation detected at Mon Sep 06 16:20:59 2004 ------------------------------------------------------------------------ Configuration: MATLAB Version: 7.0...

Compiling LCC using LCC-Win32
Can I compile a LCC cross compiler using LCC-win32 ? webshared wrote: > Can I compile a LCC cross compiler using LCC-win32 ? > Yes. ...

Error compiling file using lcc compiler
Hi I'm using the lcc compiler for win32. I tried compiling a program but there's an error stating: "cpp: Can't open input file clrscr()" I don't get it - I've included <tcconio.h>. (strange why they couldn't have just left it as <conio.h>?): #include <tcconio.h> // code ---- Albert Albert wrote: > Hi > I'm using the lcc compiler for win32. I tried compiling a program but > there's an error stating: "cpp: Can't open input file clrscr()" > > I don't get it - I've included <tcconio.h>. ...

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); ...

Compiled or not compiled
I need to distinguish between two situations: one when a Matlab function is run from Matlab command window and the other one when it is run in compiled mode. Any ideas how to do this? Thanks Tomy Duby "Tomy Duby" <tomy.duby@agilent.com> wrote in message news:idq8q8$85k$1@fred.mathworks.com... > I need to distinguish between two situations: one when a Matlab function > is run from Matlab command window and the other one when it is run in > compiled mode. > Any ideas how to do this? HELP ISDEPLOYED. -- Steve Lord slord@mathworks.com comp.s...

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...

Compiling Compiler
Hi there, I need some advice/opinion of the experts out there regarding compilers. I have sun cc compiler that supports 64 bit environment. Now, I compile ACK using this compiler.This should give a compiler that supports 64bit environment. Since the output files are in Solaris format, I compile the ACK source *once again* using the just compiled ACK compiler so that I get Minix object and binary files. Now my questions is that does this 2nd version of ACK be able to produce true 64bit code? Sanky wrote: > Hi there, > > I need some advice/opinion of the experts out there regarding...

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 /*...

Compiler segments
Any one just let me know what are the different segments in a compiler and what data are stored in different segments???? karthik.infoguy wrote: > Any one just let me know what are the different segments in a compiler > and what data are stored in different segments???? I have no idea what you mean by "segments in a compiler". Could you elaborate? On Mar 8, 9:32 pm, "karthik.infoguy" <karthik.infogu...@gmail.com> wrote: > Any one just let me know what are the different segments in a compiler > and what data > are stored in different segments???? ...

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 ...

which compiler compiled?
Is there a way I can tell which compiler compiled an executable? I looked at the file with a hex editor and didn't see anything obvious. Lawrence "Lawrence" <just4me@nowhere.com> writes: > Is there a way I can tell which compiler compiled an executable? Yes with some compilers and some executable formats. E.g. on HP-UX for PA-RISC: $ aCC leak.C $ odump -compunit a.out ... 6 0 ANSI C++ leak.C /tmp ctcom options = -inst compiletime -diags 523 -inline_power 1 -longbranch 2 -unique_strings on -cachesize 256 B...

To compile or not to compile
Is there some benefit in compiling the apache source yourself? -- //Points ------------------------------------------------------------ http://underthebed.homeip.net ...

To compile or not to compile
Is there some benefit in compiling the apache source yourself? -- //Points ------------------------------------------------------------ http://underthebed.homeip.net ...

Web resources about - Exception: Segment Violation - comp.compilers.lcc

Resources last updated: 2/12/2016 4:51:34 AM