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 1266 articles. 0 followers. Post Follow

1 Replies
890 Views

Similar Articles

[PageSpeed] 5
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:

access fault exception
Hi, I'm using CW 8.3 to develop a Carbon program under OS X. I have an access fault exception everytime I run it. My program looks like that : main() { init_interface() char *p = (char*)malloc(5); printf("%p\n", p); // prints: 0x00280a10 free(p); // <- crash here main_loop() } The stack is : __start main free __pool_free I think that I have a bug in the init_interface() function, but I don't know how to find it. Which tool should I use ? Thanks, Jean-Marc -- http://www.oksid.ch In article <3EFC7893.54DB3735@bluewin.ch&g...

I need help for a segment a imagen
hello.,,, i'm chilean and it the reazon that my english is not very well. so, I'm work in my thesis and I don't know how can I segment the imagen. The thesis's object is the to recognize a person and to differentiate of the some animal like dog and i need cut only the person or animal. If a somebody have a some algorit for make the segmentation, pleace write a mail. "Carlos" <carcoliri@gmail.com> wrote in message news:ef17c3b.-1@webx.raydaftYaTP... > hello.,,, i'm chilean and it the reazon that my english is not very > well. > > so, I'm w...

Exception
Why if an error is present no one of exception is write? I create an array index exception for testing. procedure Testo is Begin .... exception when Error : Constraint_Error | Data_Error => Put ("Si � verificato un errore: "); Put_Line (Ada.Exceptions.Exception_Name(Error)); when Error : others=> Put ("Si � verificato un errore: "); Put_Line (Ada.Exceptions.Exception_Name(Error)); raise; end testo; TC a �crit : > Why if an error i...

Machine Check Exception: 0 Bank 5: 1000001004000e0f
Hi, we have a server (Supermicro X7DBE+ Board with 16 GB ECC RAM) that is running Linux (Debian Etch). Since we upgraded to a kernel >2.6.18, we see this exception: HARDWARE ERROR CPU 1: Machine Check Exception: 0 Bank 5: 1000001004000e0f TSC 0 This is not a software problem! Run through mcelog --ascii to decode and contact your hardware vendor Kernel panic - not syncing: Machine check decoded with mcelog: HARDWARE ERROR. This is *NOT* a software problem! Please contact your hardware vendor CPU 1 BANK 5 MCG status: MCi status: Invalid log BQ_DCU_READ_TYPE BQ_ERR_AERR2_TYPE BQ_ERR_AERR...

Exceptions list - Unix ENOENT not the name of the exception
Hi, I'm trying to open a file, and if the user hasn't given an extension, adding one, but I can't find out what exception to use. If I leave off the rescue statements, then I see ENOENT, so try using that, but get a NameError - ENOENT is the Unix error, not Ruby's. So, what is the exception for a missing file on IO.foreach, and how in general can I get a list of exceptions or find out which is the right one to use? eg: if $include_header orig_hdr_fname=header_fname begin IO.foreach(header_fname) do |hdr_line...

Possible to do the following with Exceptions ?
The code I work on has a class called "CException" which gets thrown whenever there is an exception. Various other exception class derive from this. The ctor for the class CException prints out the stack trace using a system function. So in the code where there is a "throw CException()" the stack trace gets printed. Even if a derived class gets throwen the stack trace gets printed because a CException object is created. Question I have is I want to do the same for exceptions thrown by the standard c++ library. When I see a std::bad_alloc exception I would like the sta...

deriving from std::exception
I am having some problems with deriving the std::exception class. My compiler (g++-2.95) works with it just fine, but it does in a lot of broken cases. I have a user/developer that can't compile the following code: class CFENException : public std::exception { std::string _what; public: CFENException(std::string what) : _what(what) {} virtual const char* what() const throw() { return _what.c_str(); } }; He is getting the following error from dev-c++ 4.9.8.1: line 57 in BitBoard.h: looser throw specifier for 'virtual line 54 in exception: overriding 'virtual Isn&...

Backup script exception handling
i would like some help with exception handling for my backup script. when i issue the command: alter system archive log all; i sometimes get the error: ora-00271 ora-00271: there are no logs that need archiving the script still keeps executing fine, but i would like an elegant error handler that if the ora-00271 error occurs, just continue as normal and don't raise an error. here is an edit of my backup script: alter system switch logfile; alter system archive log all; alter system archive log current; host copy F:\oracle\assist\archive\*.* F:\oracle\Backups\As...

catching exceptions from an except: block
Hi all, Imagine I have three functions a(x), b(x), c(x) that each return something or raise an exception. Imagine I want to define a function that returns a(x) if possible, otherwise b(x), otherwise c(x), otherwise raise CantDoIt. Here are three ways I can think of doing it: ---------- # This one looks ugly def nested_first(x): try: return a(x) except: try: return b(x) except: try: return c(x) except: raise CantDoIt # This one looks long-winded def flat_first(x): try: return a(x...

JComboBox class cast exception
Hi I have a JComboBox in a JTable. It works fine but if I try to setEditable(true) for JComboBox then I get class cast exception. Any idea why setEditable(true) causes this exception? Thanks ...

OT Exception handling testing
Hi, Sorry for the slightly OT post but I thought someone in this NG would know what I'm looking for. A header file I believe by the name of memtester or similar that would test your exception handling for out of memeory errors. I can't find it on google. the same guy had loads of stuff on his site, like Radiosity analyser for generating lightmaps, stuff for fonts.... Thanks Mike ...

Alignment exception examples
Hi, I want to extend ARMalyser's static code analysis engine to report potential alignment exceptions in ARMv7 code. Can anyone point me at code known to produce alignment exceptions on the Beagle board, so I can see if ARMalyser does actually spot them in real code. If possible I'd like examples of both data alignment and branches with bit 0 set. Free software which I can download would be my first preference, but if anyone has some of their own code (such as old versions of software prior to being fixed), please reply before sending the code so my mail box doesn&#...

[tao-bugs] Unexpected exception result in core dump
TAO VERSION: 1.3 ACE VERSION: 5.3 HOST MACHINE and OPERATING SYSTEM: SUN UltraSPARC SUN Solaris 8 TARGET MACHINE and OPERATING SYSTEM, if different from HOST: COMPILER NAME AND VERSION (AND PATCHLEVEL): SUN WORKSHOP Forte6C++ update 1 AREA/CLASS/EXAMPLE AFFECTED: DOES THE PROBLEM AFFECT: COMPILATION? No LINKING? No EXECUTION? Yes SYNOPSIS: I had one core and this is the process stack: ----------------- lwp# 11 / thread# 10 -------------------- fea591f0 __sigprocmask (fea5b7f4, 0, 0, f9c0fd98, fea6c00...

874: General exception error has occurred in the optimizer.
Hi, I�m using IDS 9.21.UC3 and when I try to execute a statement SQL containing many joins i receive the error: 874: General exception error has occurred in the optimizer. I found in the Informix site that it is a bug fixed in 9.21.xC7, then it�s my problem? This conclusion is right? There is patche to fix the bug without update the version of my IDS? tks On Wed, 05 Nov 2003 12:44:37 -0500, Wellidy Almeida wrote: It certainly looks that way. Though there are major advantages to upgrading. Art S. Kagel > Hi, > > I�m using IDS 9.21.UC3 and when I try to ...

Exceptions + Performance on path without exceptions
The application I'm working on will run on Linux, in user space. If I use exception handling in parts of the application, will that affect the performance of sections of code which do not use any exception handling? Basically, I'm looking at optimizing a critical path, and wondering if I can keep the exceptions elsewhere in code which are working fine. On 16 Apr., 19:23, gratc...@gmail.com wrote: > The application I'm working on will run on Linux, in user space. If I > use exception handling in parts of the application, will that affect > the performance of sections o...

Re: Shared memory segment IDS 9.4
Wojtek, the server will allocate all the buffer's you have asked for. The rest of your buffers which will not fit in the first resident segment will go into the next virtual segment(s). You can look them up with onstat -g mem where you should see a pool named something like "ovrfl-buf". Nothing to worry about ... Cheers -- Steffen. Wojtek Korg�l wrote: > Hi, > > I defined 1200000 BUFFERS in $ONCONFIG file for IDS 9.4/AIX 5.3. I used a > formula from Performance Guide and counted that the buffers should take in > resdident portion of sh...

exception and $!
the pickaxe tells me that the last exception is available in $!, but c:\>irb irb(main):001:0> raise "Its all bad!" RuntimeError: Its all bad! from (irb):1 irb(main):002:0> puts $! nil => nil same thing happens from a script. Its windows c:\>ruby -v ruby 1.8.4 (2005-12-24) [i386-mswin32] any ideas? Thanks Paul On Apr 23, 6:55 pm, Paul Rogers <pmr16...@gmail.com> wrote: > the pickaxe tells me that the last exception is available in $!, but > c:\>irb > irb(main):001:0> raise "Its all bad!" > RuntimeError: Its all bad! > ...

jcombobox
I have the following code, and always get the error exception java.lang.ArrayIndexOutOfBoundsException try{ jComboBox1.removeAllItems(); } catch (Exception ex){ System.out.println("exception " + ex); } The value for selectedIndex for this combo box seems to default to -1 even though I change it to zero -- could this be the problem? Thank you very much. On 22-02-2005 06:55, Sue wrote: > I have the following code, > and always get the error exception > java.lang.ArrayIndexOutOfBoundsException > > try{ > jComboBox1.removeAllItems(); > } > catch (Exception...

raise Exception or raise Exception()
I have seen both forms and I'm not sure if they're both correct, or one is right and the other wrong. In practical terms, the two of them seem to have the same effect. Cheers, Ernest On Sun, Nov 14, 2010 at 8:58 AM, ernest <nfdisco@gmail.com> wrote: > I have seen both forms and I'm not sure if they're > both correct, or one is right and the other wrong. They're both acceptable (although obviously you should always raise a more specific error than Exception). `raise SomeException` is in fact equivalent to `raise SomeException()`. Providing an err...

about exception specification
Hello everyone, How do you understand the comments from Bjarne about exception specification? -------------------- (section 14.6.1 Checking Exception Specifications) The way to think about exception-specifications is to assume that a function will throw any exception it can. The rules for compile-time checking exception-specifications outlaw easily detected absurdities. -------------------- thanks in advance, George * George2: > > How do you understand the comments from Bjarne about exception > specification? > > -------------------- > (section 14.6.1 Checking Except...

Exception raised
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0 at com.mathworks.mlwidgets.graphics.PlotArgDescriptor.createFromVarInfo(P lotArgDescriptor.java:163) at com.mathworks.mlwidgets.workspace.graphics.GraphingActionFactory.getGr aphingActions(GraphingActionFactory.java:54) at com.mathworks.mlwidgets.array.CellTable$SelListener.valueChanged(CellT able.java:76) at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source) at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source) at javax.swing.DefaultListSelectionModel.fire...

java exception occured
Hello, I am trying to connect MATLAB with MS Access Database, but it showing me following 'java exception occurred' error while running. It updates data only once to the database(MS Access) and showing this error. can anyone please suggest the solution... ??? Java exception occurred: sun.jdbc.odbc.JdbcOdbcBatchUpdateException: General error at sun.jdbc.odbc.JdbcOdbcPreparedStatement.emulateExecuteBatch(Unknown Source) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeBatchUpdate(Unknown Source) at sun.jdbc.odbc.JdbcOdbcStatement.executeBatch(...

EJB Application show not bound Exception
Hello Friends, I am making sample Application Using EJB in MyEclipse....I have done without any error...but when i will run client java application then it will show error javax.naming.NameNotFoundException: Simple not bound If any one idea then reply me soon. i didn't get exactly what u are trying to say.just respecify your problem with exact informations like what u are trying to do and what u want the program to do. Regards, pathik ...

Exceptions for Dummies?
Hi Folks: Developing on Win2K, VC6, WIN32, no MFC. I've never used exceptions, of course I handle exceptions generated by vendor code. So I'm familiar with with try-catch clauses. I've had good luck testing the code before the client sees it, but recently he's had some run time errors that I've had trouble duplicating. I find that I can trap these errors with try-catch. The location of the trap tells me more than I knew, but I want more info to pinpoint the problem. Here is a fragment that shows my confusion. #include <exceptio...

Custom exceptions -- inherit from exceptions.Exception?
Is there any particular good reason to inherit from exceptions.Exception? I've never seen any code that depends on what the base class(es) of a raised exception is (are). My use case is in a game I am writing. The code for my Game class contains the following: class Game (object): def start (self): try: self.players[1] except IndexError: raise NotEnoughPlayers where NotEnoughPlayers is really just an empty classic class suitable for raising. Is there any benefit to importing exceptions and inheriting from exceptions.Exception, other than m...