"hating gcc" or "random errors make life interesting"

[prev] [thread] [next] [lurker] [Date index for 2004/04/05]

From: Simon Wistow
Subject: "hating gcc" or "random errors make life interesting"
Date: 11:38 on 05 Apr 2004
I am starting to get used to the fact that some specialist software, 
which doesn't have the benefit of a massive testing base, doesn't do 
what it says on the tin. The most recent one being some SAN software 
that, despite its only real job being to hold a sequences of bits in 
*precisely* the same order was when they were put down, err, doesn't. 
Random flip-flop a-go-go. *sigh*

But that is a diffwerent hate. And at leats the developers are 
responsive.

However gcc has *masses* of testing. Masses. It is, probbaly, the most 
widely used compiler in the world or, if not, close. [0]

I have this code. It is fairly crufty because I've spent the last two 
working days (well, 1 and a half including this morning) rewriting it 
and rewriting it and cursing myself for inexplicably having a 2 day 
braino.

Yes. I blamed myself. As Klortho's advice number 11907 says 

 
						  -*-
   Looking for a compiler bug is the strategy of LAST resort.  
                        LAST resort. 
                          -*-


And this was a potential mass of fence post erros and a whole other 
county things.


	while (i=files()) {

		if (_start<0) _start = i;
		if (_end<0)   _end = i;

		if (_end<i-1 || i<0) {
			if (_start != _end) {
				cerr << _start << "-" << _end;
			} else {
				cerr << _start;
			}
			
			if (i>=0) {
				cerr << ", ";
			}
			_start = i;
		}
	

		_end = i;

		if (i<0) break;
		//cerr << "";
	}


The code is designed to take a list of numbers such as 

1,2,3,4,6,8,9,11

and turn them into

1-4, 6, 8-9, 11

Which is all well and good. Except, well, notice the commented out 
thing at the bottom? If I uncomment it, it works perfectly. If it's 
commented than it all goes tits up and never recognises the end of a 
sub-sequence.

*sigh*

And turning off O2 optimisation doens't work either. I'm wondering if 
it's some reserved token problem based on _end. Hrrmm, no. Changing it 
to _foo doesn't work either. 

My god, it really is shite. I hate you gcc. May a thosuand hairy backed 
baboons violate your ocular cavities.

Simon


[0] Warning, contains traces of arbitary numbers and wild speculation


-- 
gap wearing anarchist

Generated at 14:02 on 01 Jul 2004 by mariachi 0.52