Reply by Corey, Rick May 11, 20052005-05-11
Hi All

By mistake, I happened to init an externed struct (see sample code below). That is a syntax error, but instead of just getting a compile error, the IDE
crashed:
unhandled exception #5.
Memory at address 0x10 could not be read.
Location: cc_m56800e.dll:0x100d62d0

This happened repeatably, and stopped happening when I removed the
initialization from the "extern" statements.

I wonder if anyone else has seen this, and whether they figured out what
makes the compiler freak out so badly:
is it just the extern, or doing it with a pointer-to-structure, or having
and enum in the structure, or what?
Maybe it was placing the extern statements _before_ defining the struct
typedef.

I originally downloaded CW ver 6.1, I believe, but here is some of what I
see in "About":
IDE.exe 5.5.1.1442
IDE MFC60cw.dll 6.00.8665.0
product 6.0.4.0 3-10-2004
CW 56800/E version 6.1.2 plugins 121 (so, version 6.1.2?)
license.dat includes: # ( 562): DSP V6.1

Does anyone know if this a known problem, solved in later releases?
What was the key syntax error that was not handled?
All I have determined was that removing "=NULL" from the externs made the
difference.

Rick Corey TaskLists.c

#include "TaskLists.h"

struct theTCB_type *pReadyList = NULL;
struct theTCB_type *pTasksWaitingForTimerTick = NULL;
struct theTCB_type *pTasksWaitingForConditions = NULL;
TaskLists.h

// note the extern BEFORE the typedef
// these NULLs were a worse problem than just a syntax error
extern struct theTCB_type *pReadyList = NULL;
extern struct theTCB_type *pTasksWaitingForTimerTick = NULL;
extern struct theTCB_type *pTasksWaitingForConditions = NULL;

enum eSemaphoreStates
{
SEM_WAITING = 0,
SEM_READY
} ;

typedef struct theTCB_type {

ulong tcb_DeltaDelayRemaining;
ulong tcb_NumRepeatsRemaining;
ulong tcb_RepeatPeriodTicks;
ushort tcb_StepNum;
enum eSemaphoreStates tcb_MoveDoneSem;

fPtrType pfFuncToRunInsideTickISR;
fPtrType pfFuncToRunInIdleLoop;
fPtrType pfFuncToRunAfterExpired;

struct theTCB_type *ptcbNextTask;
struct theTCB_type *ptcbSameTimeTasks;
}; Rick Corey
Sr. Software Engineer