Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!nosc!crash!pnet01!lkoop From: lkoop@pnet01.cts.com (Lamonte Koop) Newsgroups: comp.sys.amiga.programmer Subject: What the #&%@? Message-ID: <7823@crash.cts.com> Date: 6 Mar 91 04:56:02 GMT Sender: root@crash.cts.com Organization: People-Net [pnet01], El Cajon CA Lines: 77 I have come face to face with a rather perplexing problem involving a project I am currently working on, to which I cannot find the answer. I'm hoping SOMEONE [read: ANYONE! please!] may have an idea as to what is going on. Anyway, the problem goes like this: The application I have set up uses a fairly standard Intuition interface setup...with the appropriate message handling loops and such. The problem arises when the code I compile is executed on a stock 68000-based system (I am currently developing on a 68030-accelerated system). The event handling loops run perfectly normal when run on the 68030 (or a 68020 for that matter)...unfortunately, things begin to flake out when the program is run in the machine's 68000 mode...or any 68000-based system. The symptoms are thus: at VERY random times, selecting a menu item will result in an Address error guru. Now, most of the menu selections simply result in a function call or so. The odd part is that there is NO way to predict which menu function will guru...or WHEN...It just happens. This does not happen AT ALL when the program is run under an 020 or 030 system. [No...the compiler is NOT set to compile for 020/030 specific code generation]. The layout of the event loop skeleton is somewhat like this: while(keepgoing) { Wait(1L << BenchWindow->UserPort->mp_SigBit); while((msg = (struct IntuiMessage *)GetMsg(BenchWindow->UserPort))) { code = msg->Code; class = msg->Class; gad = ((struct Gadget *)msg->IAddress)->GadgetID; ReplyMsg((struct Message *)msg); switch(class) { /*start of the action-determining section*/ case MENUPICK : mnum = MENUNUM(code); mitem = ITEMNUM(code); subitem = SUBNUM(code); switch(mnum) { /*Determine action according to which menu*/ case 0 : if(!ShowAbout()) Error("Insufficient Memory!"); break; case 1 : if(!DoSysInfo()) Error("Unable to open window!"); break; Well, anyway that's the general idea. There's more for processing gadgets, (and the rest of the menu items). For example...case 1 above for menu 0 [the DoSysInfo() call] will guru...SOMETIMES on a 68000 machine...NEVER on an 020 or 030 machine. The same goes for various other items. Generally, the GURUs start to appear after I've done some other action first...but I've had them happen right off. I've been trying to figure this out for a week now with no ideas at all. Additional info: I'm using Lattice C 5.10a, with the following compile options: -ma (any processor code...will run on any machine, optimized to 68010 timing when it won't degrade 68000 performance...does not generate 010+ specific code..will run on an '000) -mt (optimize time) -b1 (base A4 data addressing) -r1 (PC-relative 16-bit offset function calls) -v (stack checking off (NO..this is not the problem...this I have determined)) -O (optimize) Link options are: SMALLCODE SMALLDATA DEFINE @_main=@_tinymain [Yes....I am using register parameters for all function calls (-rr option for compile)] I do note that when I link...I get a blink message three times: Error 515: An ALV was generated pointing to function @XCEXIT NOALVS as an option to blink does nothing to this...but even given this, it still would not explain this bizarre behavior. ANY IDEAS folks? Feel free to E-Mail me, or post here, as I read the group regularly. I aplogize sincerly for taking up so much bandwidth, but this is driving me crazy... LaMonte Koop Internet: lkoop@pnet01.cts.com ARPA: crash!pnet01!lkoop@nosc.mil UUCP: {hplabs!hp-sdd ucsd nosc}!crash!pnet01!lkoop "It's a dog-eat-dog world...and I'm wearing Milk Bone underwear"--Norm