Dungeon Crawl Stone Soup Tracker - DCSS
Viewing Issue Advanced Details
6661 Bug Report crash sometimes 2013-02-18 19:51 2014-11-19 02:18
PostmodernBrony Local  
wheals MacOSX  
normal Tiles  
resolved 0.11 ancient branch  
DCSS 0.11.2 done  
none    
none 0.16 ancient branch  
0006661: Potion of experience crashes when compiled with OS X gcc
I am running DCSS 0.11.2 on a Mac OSX 10.6.8. My Draconian transmuter has attempted to quaff a "Lumpy Yellow potion," which has yielded a couple of interesting results:

-If there are enemies nearby, and i attempt to Quaff the potion, the game crashes instantly. Attempts to reload the game will reload my progress from the last set of stairs i travelled down.

-Attempts to quaff the potion on the staircase will reveal it as a Potion of Experience. My initial attempt to quaff this potion left me to quit the game and re-open my saved data; despite the fact that the game reverted to a turn in which the potion had not yet been quaffed, it grants experience levels as if i have quaffed a potion of experience.

Unfortunately, a recent clearning of my cache has emptied my morgue file, but i will attempt to post a character dump as a comment to this post as soon as is possible.
has duplicate 0006736resolved mumra Quaff Identifying Potion of Experience Causes Crash 
has duplicate 0006737resolved mumra Felid of Kikubaagudgha bug (I think) 
has duplicate 0006945closed neil quaffing potion of experience either crashes or causes levels to max out 
has duplicate 0006949closed  Legendary Experience Card causes Crash 
has duplicate 0006961resolved mumra Felid - crashes, corrupts saved game after dying with 2 lives remaining 
has duplicate 0007024closed neil quaffing a potion of experience causes the game to crash 
has duplicate 0007046resolved mumra Felid crash when resurrecting at medium- to high levels. 
has duplicate 0007069resolved mumra mac trunk crashing after quaffing a potion of experience 
has duplicate 0007191resolved Medar Crash when drinking potion (assert failed at adjust_level(int, bool) + 1545) 
has duplicate 0007222closed  Potion of Experience Crash 
has duplicate 0007240resolved mumra Felid of Nemelex Xobeh instantly leveled to 27 upon death 
has duplicate 0007286resolved mumra crash when trying to save felid life 
has duplicate 0007485resolved Galefury game crashes when drinking a potion of Experience 
related to 0005257resolved mumra Felid respawn while leveling gives infinite levels. 
related to 0006882assigned gammafunk Simplify OS X build and default to clang 
related to 0007541closed brendan Spells do not cost MP 
related to 0007568resolved wheals Game crashes every time experience potion quaffed or Closed Gate opened 
txt file icon crash-Parar2-20130226-062057.txt [^] (43,904 bytes) 2013-02-26 18:26 [Show Content]
txt file icon macassertcrash.txt [^] (48,448 bytes) 2013-03-05 07:23 [Show Content]
? file icon BeefStick.cs.bak-16-levels [^] (374,938 bytes) 2013-04-09 06:08
txt file icon crash-Fernmeister-20130509-230406.txt [^] (37,335 bytes) 2013-05-10 17:49 [Show Content]
Issue History
2013-02-18 19:51 PostmodernBrony New Issue
2013-02-26 18:23 HenryFlower Note Added: 0021174
2013-02-26 18:26 HenryFlower File Added: crash-Parar2-20130226-062057.txt
2013-02-26 18:29 HenryFlower Note Added: 0021175
2013-03-05 07:13 pivotal File Added: expassertcrash.log
2013-03-05 07:13 pivotal Note Added: 0021261
2013-03-05 07:20 pivotal Note Added: 0021262
2013-03-05 07:22 elliptic File Deleted: expassertcrash.log
2013-03-05 07:23 pivotal File Added: macassertcrash.txt
2013-03-14 07:41 HenryFlower Note Added: 0021457
2013-03-14 07:51 HenryFlower Note Added: 0021458
2013-03-14 12:16 mumra Note Added: 0021462
2013-03-14 12:17 mumra Note Added: 0021463
2013-03-14 15:42 HenryFlower Note Added: 0021480
2013-03-14 15:54 HenryFlower Note Added: 0021483
2013-03-14 17:34 HenryFlower Note Added: 0021486
2013-03-14 18:28 mumra Note Added: 0021487
2013-03-14 20:00 HenryFlower Note Added: 0021488
2013-03-14 20:31 mumra Note Added: 0021489
2013-03-14 21:26 KiloByte Note Added: 0021490
2013-03-14 21:29 pivotal Note Added: 0021491
2013-03-14 22:12 mumra Relationship added has duplicate 0006736
2013-03-23 01:30 HenryFlower Note Added: 0021770
2013-03-23 01:46 HenryFlower Note Edited: 0021770
2013-03-26 17:00 mumra Note Added: 0021824
2013-03-26 23:17 HenryFlower Note Added: 0021835
2013-03-27 04:59 mumra Note Added: 0021842
2013-03-27 15:13 HenryFlower Note Added: 0021889
2013-03-27 15:50 mumra Note Added: 0021892
2013-03-27 17:22 HenryFlower Note Added: 0021895
2013-03-27 17:28 HenryFlower Note Edited: 0021895
2013-03-27 19:48 mumra Note Added: 0021913
2013-03-27 20:19 HenryFlower Note Added: 0021917
2013-04-03 23:40 HenryFlower Note Added: 0022128
2013-04-08 20:04 mumra Relationship added has duplicate 0006737
2013-04-08 21:32 mumra Relationship added related to 0005257
2013-04-09 06:08 bobross419 File Added: BeefStick.cs.bak-16-levels
2013-04-09 06:09 bobross419 Note Added: 0022217
2013-04-09 17:08 HenryFlower Note Added: 0022223
2013-04-22 07:16 neil Relationship added related to 0006945
2013-04-22 07:17 neil Relationship deleted related to 0006945
2013-04-22 07:18 neil Relationship added has duplicate 0006945
2013-04-22 07:19 neil Summary Potion causes the game to crash => Potion of experience crashes when compiled with OS X gcc
2013-04-22 10:42 Kerri Chandler Note Added: 0022383
2013-04-22 11:16 Kerri Chandler Note Edited: 0022383
2013-04-22 11:35 Kerri Chandler Note Edited: 0022383
2013-04-22 11:35 Kerri Chandler Note Edited: 0022383
2013-04-22 11:36 Kerri Chandler Note Edited: 0022383
2013-04-22 11:38 Kerri Chandler Note Edited: 0022383
2013-04-22 11:51 Kerri Chandler Note Edited: 0022383
2013-04-22 19:55 Kerri Chandler Issue Monitored: Kerri Chandler
2013-04-22 21:07 Kerri Chandler Note Deleted: 0022383
2013-04-22 21:22 Kerri Chandler Note Added: 0022388
2013-04-22 21:59 Kerri Chandler Note Edited: 0022388
2013-04-23 03:02 HenryFlower Note Added: 0022391
2013-04-23 11:49 KiloByte Note Added: 0022396
2013-04-23 13:05 Kerri Chandler Note Added: 0022398
2013-04-23 16:51 HenryFlower Note Added: 0022400
2013-04-23 17:15 sgrunt Relationship added has duplicate 0006949
2013-04-23 19:45 KiloByte Note Added: 0022405
2013-04-24 22:18 mumra Relationship added has duplicate 0006961
2013-04-25 21:40 Kerri Chandler Note Added: 0022443
2013-04-26 03:13 Kerri Chandler Note Edited: 0022443
2013-04-26 03:13 Kerri Chandler Note Edited: 0022443
2013-04-26 03:14 Kerri Chandler Note Edited: 0022443
2013-05-08 22:57 neil Relationship added has duplicate 0007024
2013-05-10 05:23 mumra Relationship added related to 0006882
2013-05-10 17:49 Alethiolet File Added: crash-Fernmeister-20130509-230406.txt
2013-05-11 17:59 neil Note Added: 0022635
2013-05-12 03:59 retchdog Note Added: 0022641
2013-05-14 16:53 mumra Relationship added has duplicate 0007046
2013-05-15 09:49 KiloByte Note Added: 0022671
2013-05-15 16:10 mumra Note Edited: 0022671
2013-05-21 14:03 mumra Relationship added has duplicate 0007069
2013-05-21 14:05 matt Issue Monitored: matt
2013-05-21 14:39 KiloByte Note Added: 0022738
2013-05-30 03:25 baphomet Issue Monitored: baphomet
2013-06-01 06:09 neil Note Added: 0023000
2013-06-02 10:01 Kerri Chandler Note Added: 0023012
2013-06-02 10:01 Kerri Chandler Note Edited: 0023012
2013-06-10 08:56 Medar Relationship added has duplicate 0007191
2013-06-17 22:05 sgrunt Relationship added has duplicate 0007222
2013-06-17 22:55 KiloByte Note Added: 0023218
2013-06-21 17:04 mumra Relationship added has duplicate 0007240
2013-06-28 22:51 nedbronco Note Added: 0023345
2013-06-29 19:06 mumra Relationship added has duplicate 0007286
2013-07-16 20:07 Reaver Note Added: 0023467
2013-08-19 12:48 Galefury Relationship added has duplicate 0007485
2013-09-07 05:53 brendan Relationship added related to 0007541
2013-09-07 19:39 neil Note Added: 0023993
2013-09-19 17:33 Galefury Relationship added related to 0007568
2014-11-19 02:18 wheals Note Added: 0027827
2014-11-19 02:18 wheals Status new => resolved
2014-11-19 02:18 wheals Fixed in Branch => 0.16 development branch
2014-11-19 02:18 wheals Resolution open => done
2014-11-19 02:18 wheals Assigned To => wheals

Notes
(0021174)
HenryFlower   
2013-02-26 18:23   
I can repro this consistently on 11.2, and have a crash file attached.
(0021175)
HenryFlower   
2013-02-26 18:29   
Similar issue:

 https://crawl.develz.org/tavern/viewtopic.php?f=5&t=7010 [^]
(0021261)
pivotal   
2013-03-05 07:13   
I experienced this same assertion failure while testing some new content locally. I have attached the crash log.
(0021262)
pivotal   
2013-03-05 07:20   
I noticed a similarity between all of these crashes. They're all occuring on mac os x, and different versions of mac os x at that.
(0021457)
HenryFlower   
2013-03-14 07:41   
I can repro on 0.12
(0021458)
HenryFlower   
2013-03-14 07:51   
OK, I'm rusty on my C/C++ but this seems fishy:

from player.h:

  unsigned int experience;

from player.cc:adjust_level:

        you.experience = ((int64_t)(new_max - new_min))
                       * (you.experience - old_min)
                       / (old_max - old_min)
                       + new_min;
        dprf("XP after: %d\n", you.experience);
    }

    ASSERT((uint64_t)you.experience <= (uint64_t)MAX_EXP_TOTAL);

Looks like code is casting to a signed then an unsigned int value to a field that is defined as unsigned int. The assert is the bit that failed. Looks like I can compile in debug mode and repo. How can I save my character in case anything bad happens?
(0021462)
mumra   
2013-03-14 12:16   
I noticed that strange cast as well (when discussing this with pivotal on irc). The only way this can cause a problem though would be if you.experience had somehow ended up negative already ...
(0021463)
mumra   
2013-03-14 12:17   
You can save your character by finding the .cs file in the saves directory and making a copy of it.
(0021480)
HenryFlower   
2013-03-14 15:42   
OK, compiling in debug mode makes the problem go away. Messages from dprf are:

XP before: 190861

0.79 of 149198 to 202231 to 202231..263749
XP after: 250559

Not at all sure why that would be the case. Trying to change all the casts to be consistent and recompiling in normal mode to see what happens.
(0021483)
HenryFlower   
2013-03-14 15:54   
And no... same issue
(0021486)
HenryFlower   
2013-03-14 17:34   
OK, I added some additional messages to the code in non debug mode. Very interesting:

Here's the code I added:

        mprf("Old XP: %d", you.experience);
        mprf("Diff: %d, Old min: %d, old max: %d, new min: %d, new max: %d", diff, old_min, old_max, new_min, new_max);

Here's the output:

Old XP: 190861
Diff: 1, Old min: 149198, old max: 202231, new min: 647185069, new max: 340116
New XP: 647211816; Max XP org: 8999999, unsigned 8999999


new_min is set in the following call (with my adjustments in type declaration):

        unsigned int new_min = exp_needed(you.experience_level + diff);

What's weird is that new_max is sane. I don't have more time until later today, but it looks like the culprit is in exp_needed?
(0021487)
mumra   
2013-03-14 18:28   
exp_needed returns "unsigned int" instead of e.g. uint32_t, and I don't really like the look of how these values are getting cast between different types of integer so much. 64bit int also seems slightly unnecessary considering the actual value of MAX_EXP_TOTAL.

My other theory was that somehow this function ended up getting called in a recursive loop but I guess your debug output disproves that!
(0021488)
HenryFlower   
2013-03-14 20:00   
I adjusted my local code to be type consistent (declared new_min as unsigned int), but still got the odd value for new_min.

I can also verify that I've quaffed experience at lower levels, no problem. So my current hypothesis is that something is going on in exp_needed in the branch where lev >= 13

One more potentially misleading clue: the species that trigger this (draconian, centaur) all use a -1 exp modifier (in species.cc) -- but I have no clue why compiling with debug solves the issue. I've got a suspicion that the cast in exp_needed is problematic:

   return (unsigned int) ((level - 1) * exp(-log(2) * (exp_apt - 1) / 4));

But really no clue. If I have time, I'll try to round that value before casting, and see if that does anything, but I'm guessing.
(0021489)
mumra   
2013-03-14 20:31   
I would declare everything as uint32_t rather than unsigned int, it is more specific. This is possibly what the problem is - "int" is not guaranteed to even be 32 bits on all platforms: http://stackoverflow.com/questions/1385709/cross-platform-primitive-data-types-in-c [^]
(0021490)
KiloByte   
2013-03-14 21:26   
mumra: platforms where int is smaller than 32 bits are so old they have no chance to ever possibly run Crawl. The most recent I know is real mode DOS, and well, 640K is not enough for everyone (Crawl used 32-bit protected mode). We use ints with this assumption everywhere, I'd say it'd be counterproductive to force them to 32 bits.

In this case, the temp value during multiplication will not fit in 32 bits, so that's why it's cast into int64_t.

you.experience may not be negative, as: 1. it's declared as unsigned (int), 2. there's an assertion that it's <= MAX_EXP_TOTAL.
(0021491)
pivotal   
2013-03-14 21:29   
HenryFlower- I have a save where this crash triggers < xl 13. It is a felid, so it may have something to do with gaining an extra life in that specific case. I'll see what happens when I quaff on a normal race.
(0021770)
HenryFlower   
2013-03-23 01:30   
(edited on: 2013-03-23 01:46)
OK, further investigation because I'm tired of not being able to take advantage of experience.

Put some stderr logging in the code for both exp_needed and adjust_level, and I get the following output prior to crash:

exp_needed:
lev: 4, level: 105500, exp_apt: -1
lev: 5, level: 143000, exp_apt: -1
lev: 5, level: -1755969896, exp_apt: -1
lev: 6, level: 240500, exp_apt: -1
adjust_level:
diff: 1, old_min: 149198, old_max: 202231, new_min: -704282740, new_max: 340116
ASSERT((uint64_t)you.experience <= (uint64_t)MAX_EXP_TOTAL) in 'player.cc' at line 3620 failed.


Run again and it's:

lev: 4, level: 105500, exp_apt: -1
lev: 5, level: 143000, exp_apt: -1
lev: 5, level: -165804392, exp_apt: -1
lev: 6, level: 240500, exp_apt: -1
diff: 1, old_min: 149198, old_max: 202231, new_min: 1544550882, new_max: 340116
ASSERT((uint64_t)you.experience <= (uint64_t)MAX_EXP_TOTAL) in 'player.cc' at line 3620 failed.

So the call to exp_needed in adjust_level gets a random value in the for the new_min value

Now, exp_needed should be deterministic. I can't see a path where calling with the same inputs is going to get a different output, so I'm a bit stumped...

(0021824)
mumra   
2013-03-26 17:00   
Note this part of exp_needed:

        if (lev < 13)
        {
            lev -= 4;
            level = 10 + 10 * lev + (60 << lev);
        }
        else
        {
            lev -= 12;
            level = 15500 + 10500 * lev + 3000 * lev * lev;
        }

Now you say this crash happened < xl 13, what level exactly were you at, was it twelve - and does this crash only happen at specific xl's around 13?
(0021835)
HenryFlower   
2013-03-26 23:17   
The crash happened for a level 16 character. If you see the stderr logging I did, the first call to exp_needed generated a final value for lev at 4 (16 - 12), second call [exp_needed(you.experience_level + 1) generated a final value for lev at 5 (17 - 12), third call [ exp_needed(you.experience_level + diff) ] generated a final value for lev at 5 as well (17 -12). Since diff is 1, the second and third calls should have generated exactly the same value, but somehow the third calls generates a random value.
(0021842)
mumra   
2013-03-27 04:59   
It is _always_ that third call or did you only do it twice? I'm wondering if it's just coincidence that it happened there both times and actually it's random when it happens.
(0021889)
HenryFlower   
2013-03-27 15:13   
Three times so far it has been the same call.

What's completely strange about this is that level is borked, but the only place that level gets set, assuming that lev had an end value of 5, is in: level = 15500 + 10500 * lev + 3000 * lev * lev

I just can't see where this goes wrong, but it does, and predictably.
(0021892)
mumra   
2013-03-27 15:50   
My thoughts are that (you.experience_level + diff) is somehow becoming a pointer at a certain stage (although in that case it makes no sense that lev is 5 after substracting 12, but the random output indicates that a value has been pulled from a random memory location).

Could you try changing that new_min line to some of these things just to see what happens:

        int new_min = exp_needed(17);
        int new_min = exp_needed((int)(you.experience_level + diff));
        int new_min = exp_needed(you.experience_level + 0 + diff);
(0021895)
HenryFlower   
2013-03-27 17:22   
(edited on: 2013-03-27 17:28)
I changed the code to read:

    int base_level = you.experience_level;
        int old_min = exp_needed(base_level);
        int old_max = exp_needed(base_level + 1);
        int new_min = exp_needed(base_level + 0 + diff);
        int new_max = exp_needed(base_level + 1 + diff);

and added to exp_needed the line:
    fprintf(stderr, "lev %d/level %d/exp_apt %d\n",lev, level,exp_apt);

Crash with output:

lev 4/level 105500/exp_apt -1
lev 5/level 143000/exp_apt -1
lev 5/level -2018641640/exp_apt -1
lev 6/level 1872612228/exp_apt -1

So two borked values for level...

Changing to:

    int base_level = 17;

And things work just fine.

Changing to:

        int base_level = (int) you.experience_level;
and crash again, with output:

lev 4/level 105500/exp_apt -1
lev 5/level 143000/exp_apt -1
lev 5/level 2030565656/exp_apt -1
lev 6/level 1577700228/exp_apt -1

Changing to:

        int base_level = (int) you.experience_level;
        int d = 1;
        int old_min = exp_needed(base_level);
        int old_max = exp_needed(base_level + 1);
        int new_min = exp_needed(base_level + 0 + d);
        int new_max = exp_needed(base_level + 1 + d);

and everything works just fine. So something's borked with diff?


But the upstream call is:

            adjust_level(1, true);

So don't see how that could be true?

(0021913)
mumra   
2013-03-27 19:48   
Seems like either a very odd compiler bug, or a memory corruption issue in a possibly completely unrelated place that just happens to be triggered by this.

Have you tried:
int d = diff;

?
(0021917)
HenryFlower   
2013-03-27 20:19   
Still go boom.
(0022128)
HenryFlower   
2013-04-03 23:40   
Recompiling with clang fixes this issue. To do so, you need the patch I posted here:

https://crawl.develz.org/mantis/view.php?id=6870 [^]

Then compile with:

make APPLE_GCC=y NO_PKGCONFIG=y CONTRIB_SDL=y TILES=y CC=clang CXX=clang++

I'm working on creating an APPLE_CLANG option and would recommend that clang be used in the future to build on OS X
(0022217)
bobross419   
2013-04-09 06:09   
I've been experiencing a similar issue. Also running on a Mac. Odd thing is that I just did a quaff-ID on an exp potion and it jumped me from level 11 all the way up to level 27. I included it in this bug report since it revolves around buggy exp potions. Save is attached as BeefStick.cs.bak-16-levels
(0022223)
HenryFlower   
2013-04-09 17:08   
Almost certainly the same issue -- you get a random value for the amount of experience you gain. Most of the time, that crashes Crawl, but randomly, you get this result.
(0022388)
Kerri Chandler   
2013-04-22 21:22   
(edited on: 2013-04-22 21:59)
For me it isn't random, I get the level up to level 27 effect when I am close to gaining a level, e.g. at 88% and up, and the crash effect when it is a low percentage.

The big values created by exp_needed look like some kind of 32-bit overflow problem. I'm not sure if signedness is a factor but it could be. The weirdness with the diff value above might be due to optimizer effects in GCC that aren't present in debug mode. My guess is that using uint64_t for all internal calculations here will fix this. It might be worth changing the type of you.experience to uint64_t as well, just to be safe.

(0022391)
HenryFlower   
2013-04-23 03:02   
See the exp_needed forensics I did above. The values of lev and exp_adj generate values for level based on this line:

level = 15500 + 10500 * lev + 3000 * lev * lev;

Note that note only was level nondetermistic, it wasn't deterministically non-deterministic. Classic random memory value behavior.

There should be no way that level can get set in any code path that is not completely deterministic. I've been trained to assume that compiler errors never happen, but I can't see a behavior where this is a legitimate optimization.
(0022396)
KiloByte   
2013-04-23 11:49   
The problem lies in Apple not updating gcc even to later point releases of 4.2. I don't know this particular failure, but we had a few other problems that show only on 4.2.1 but not 4.2.later -- these bugs have long since been fixed.
(0022398)
Kerri Chandler   
2013-04-23 13:05   
Why don't you guys build binaries for distribution with an updated gcc from Fink / MacPorts / Homebrew or something? I've been using Fink's gcc for a long time and I've never had a problem with it. It's pretty straightforward to set up too.
(0022400)
HenryFlower   
2013-04-23 16:51   
clang/llvm is the going forward platform for OS X and compiling with clang completely fixes this issue.
(0022405)
KiloByte   
2013-04-23 19:45   
<quote>clang/llvm is the going forward platform for OS X and compiling with clang completely fixes this issue. </quote>
Only if we'd completely drop support for all version of OS X other than most recent ones. Clang only very recently gained the ability to compile Crawl at all, and Apple drops support for past versions pretty swiftly.

While testing with Crawl is worth the effort (only some warnings are bogus!), it's not fit for official binaries, especially on OS X.
(0022443)
Kerri Chandler   
2013-04-25 21:40   
(edited on: 2013-04-26 03:14)
I can't get 11.2 to build on my system due to what gcc says are syntax errors. Since this potion of experience problem goes away in debug mode, can someone who can get the tiles version to build make either a -O0 or -O1 binary? Then at least we have a working game - it's frustrating not being able to quaff them.

After writing the above I realized that for a single potion, quaffing at level 25 at 99% is a justifiable workaround, and I'm happy enough with that.

(0022635)
neil   
2013-05-11 17:59   
Could someone post the disassembly of the relevant code with both -O2 and -O0? I don't have a Mac. You can use gdb:
(gdb) disassemble/m adjust_level
(0022641)
retchdog   
2013-05-12 03:59   
fwiw, i'm still experiencing the same problem on the precompiled mac os tiles-0.12.0 (which is the version at the main download site, despite it saying 0.12.1). this is pretty serious; the game is now more or less broken for mac users who don't have a build environment set up. if they work, can we get the clang binaries available for now as an option?
(0022671)
KiloByte   
2013-05-15 09:49   
(edited on: 2013-05-15 16:10)
Waaaait... so building with -O1 sidesteps the issue? So what the hell are we fussing about? Sacrificing ~ 10 percent of speed (only -O0 is several times as bad) is a good price for an easy solution. Bugs in the compiler are not easy or pleasant to work around, and while I consider miscompilation with better optimization due to _our_ fault a major dishonour, that's not the case when the fault lies outside.

(0022738)
KiloByte   
2013-05-21 14:39   
I made trunk default to -O1 on gcc-4.2, which should work around this problem, but I have no means to test.
(0023000)
neil   
2013-06-01 06:09   
I applied the same change to stable (0.12.1-55-g705c954), so hopefully the 0.12.2 binaries will work properly on OS X.
(0023012)
Kerri Chandler   
2013-06-02 10:01   
Note that I was simply referring to HenryFlower above who wrote, "OK, compiling in debug mode makes the problem go away." I was speculating that debug mode implied -O0 or -O1 (more likely to be -O0, but I honestly don't know). At any rate, there is probably a single gcc optimization that is causing this, and I'd say the chance is more than 50/50 that the buggy optimization is enabled by -O2 but not -O1.

Nevertheless, thanks and here's hoping it works.

(0023218)
KiloByte   
2013-06-17 22:55   
Current Mac builds drop to -O1, does this work around the problem?

ICEs and bad optimizations happen quite frequently with Crawl's code base, especially with aggressive techniques favoured by some of us. For example, few projects default to LTO (like Crawl on Debian), and known failures include:
* gcc-apple-4.2 on OS X, > -O1
* gcc-4.4 on powerpc, > -O0
* gcc-4.6 on sparc, LTO
* gcc-4.8 on powerpc, LTO
* gcc-snapshot on amd64, LTO
* clang-3.0, (untried 3.1), 3.2, 3.3 on amd64, LTO
(I never tried clang outside amd64)

With Apple's insistence on using clang before it stabilizes, I guess we'll be forced to switch one day, but it would meaning drop support for older versions of OS X. As Crawl works well on Win2k, Debian etch, etc, I believe it's good to keep compat as long as reasonably possible. Non-default optimization levels are a small price to pay.

Could anyone confirm it indeed works with -O1 on OS X?
(0023345)
nedbronco   
2013-06-28 22:51   
Same issue here. I have a nice character going and would very much like to proceed, but I just don't want to progress without the experience that should be there. It sounds like a 12.1 or 12.2 build should be available/doable to help with this, but I can't find anything beyond 12.0 for OSX on http://crawl.develz.org/wordpress/downloads... [^]

Help?

Thanks for all the work.
(0023467)
Reaver   
2013-07-16 20:07   
I just want to mention I tried this in wiz mode (two different level 1 Trunk characters quaffing 12 XP potions in a row) and it seems the bug has been fixed. At the very least it didn't crash.
(0023993)
neil   
2013-09-07 19:39   
After encountering another bug caused by this compiler (in trunk MP was not being subtracted), we have disabled optimisation altogether when using gcc 4.2, for both trunk (0.13) and subsequent 0.12 releases (if we ever manage to get one compiled for a Mac).
(0027827)
wheals   
2014-11-19 02:18   
We no longer support ancient GCC.