This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/45265] GCC has an intermittent bug when computing the address of function parameters



------- Comment #48 from rogerio at rilhas dot com  2010-08-13 21:16 -------
(In reply to comment #47)
> OK, here is the deal:
> Since you want this feature so much, I'm sure that everybody would gladly
> implement it for you, for - say - measly 5000 EUR. You can then offer this
> c-like compiler to the world and save the planet. Just imagine, how the link to
> this enhanced compiler would be a great addition to your Wikipedia entry!
> You can even call this custom compiler whatever you like, except gcc.
> You will rewrite the history!

It sounds like a good deal. Really, I'm not being sarcastic in any way. I would
like to have 5000 to invest on GCC.

Maybe you all got me wrong: the reason I wrote the 2 bug reports is because I
do think GCC is a *very important project for the community*. I'm being honest.
If GCC were not important I would not have gone to any trouble at all, yet
alone spend several hours writing 2 or 3 complete reports (with files and
snapshots) and many messages. Maybe it is time for you to understand what I
really am all about. I say stuff about GCC, I've called "lowest common
denominator" (and I mean it), but I still think it to be among the top 5 most
important compiler projects in the world (including Microsoft's and Intel's and
a bunch of comercial compilers). It could be top 1, if it weren't for being so
confined to C99 and not *want* to go beyond it.

And I would like to have 5K to put on GCC. As I said I know I can't demand
anything, after all the thing is being offered to me! Even more than that: it
is being offered to me without me having ever contributed with a bit. So, as I
said before, I'm not demanding anything (nor could I).

I was just hoping that you would see the importance of "my feature" (although I
still call it a bug and not a feature, and if you want I can give you examples
of why it is important to be able to initialize classes as function
parameters). You didn't see it? Or you saw it but you don't agree that it is
important? I'll insist, I'll bring new angles to the discussion. Still no? I'll
insist some more, maybe get some other examples. Nothing still? Whatever, I'll
shut up and go away, no problem. The reason I'm still here is (to a great
extent) because of Michael... that guy just cracks me up. It is possibly the
person that I've ever known that has such a high "error rate" (it was up to
100% for a while there!). But this conversation has stopped being about my bug
reports a long long long long time ago. I'm on vacation, so I have had more
time on my hands than I'm used to, and Half Life 2 bores me a little if I play
it for too long! :-) ... so I keep comming back. As I said before I will seek
help. Just one more, this is the last one!!! Promise!! I'll buy a new game and
leave you all alone soon! :-)

I posted the criticism on Wikipedia not to hurt anyone in particular. But I do
criticize GCC for not being able to guarantee correct pointer arithmetic. And
me, as a citizen of this world, have the right to make my criticism and post it
where everybody can see and judge for themselves. And, being an important
criticism, I should back it up. So I did, and posted 2 references.

I was very careful not to write anything that might be incorrect or misleading.
I quoted our conversation almost exactly. And even with the different words I
made sure the content is exactly the same as in my conversation with Michael. I
didn't lie. I didn't distort. I didn't exagerate. I didn't take it out of
context. I said it like it is, no more, no less.

So here is the deal to you:

If you all agree with Michael then my Wikipedia post is correct and has a
reason to exist, and people like me will want to be alerted to what it says.
Programmers don't go around reading C99, generally speaking they just try to
write good code. That's it. I would guess 90%+ of programmers don't go out
checking if their line of code is C99 conformant or not. However, I believe
their code can be more than 99.9% C99 conformant, so very little people have
any problems.

I'm one such programmer, I hadn't read C99 before talking to you but 99.9% of
what I do falls completely within the things defined in C99. But there is a
fraction of what I do that does not fall there, and I still have to do it. And
like me there are many others, who have a fraction of their work fall outside
C99 (without knowing). And the code still has to work. Always. Guaranteed. And
we trust the compiler to give us the "expected" result. Always. Guaranteed. If
I am wrong in trusting it then I want to be alerted. That's all I did in the
Wikipedia post: alert people that do code for memory mapped devices and similar
(like I often do).

So if you think Michael is correct then he is, in fact, a hero. He is the one
guy, on the face of this planet that I know of, that had the balls to come out
and say "beware of pointer subtraction when using GCC!!". No sarcasm here, I
trully believe this.

If he is, in fact, right then I will personally thank him because up to this
point I trusted pointer subtraction implicitly for *ANY* compiler in the world.
My conversation with him shows that I've been trusting that since the 80's,
from the time of the 8086 or 80286. And I've been successful always, so I kept
on believing all these decades.

So, at the same time I criticize GCC's "unreliable pointer subtraction" I could
write in Wikipedia that Michael is the guy who provided this information to the
world. If he is right then I already did that and his name is there for the
credits. And I already know he truly believes he is right, so I must not have
hurt his feelings in any way.

I wrote the criticism on Wikipedia because I really believe that if Michael is
right then GCC is a very big risk for memory mapped devices (or cases that need
similar constructs). And I do believe it is unacceptable to any developper that
code that is working today may break tomorrow for some unexpected event
(unexpected on the programmers part, since memory mapped devices are outside
C99's definitions). I kid you not, I've seen problems cause by compilers too
many times.

As I told you before I had 3 reasons to post my message there: any of the first
2 would have been enough to go to Wikipedia, the 2 together even more, the 3rd
is just an added bonus, by itself it wouldn't justify posting anything
anywhere. And Michael said a lot of crap, but only the pointer subtraction was
important enough to affect the programmer's assumptions and merit public
display. The rest I just ignored.

As we both know, code built with GCC (or any other compiler) always produces
correct results. And we know the results will forever be correct, because one
would have to write specific code in the compiler to mess up the arithmetic at
those specific instances not defined by C99 (something like "if (p1 or p2 not
in c99 known space) then mess up p2-p1"). But according to Michael we cannot
trust that, officially, because C99 does not define it, and I criticize that
(and a large part of the comunity will too). Hence my hope that GCC will
benefit from the post, in the long run.

Now if Michael is wrong then that is a completely diferent matter. Personally I
believe he is wrong, and I think he is an idiot. He let his personal pride and
inability to take a criticism and shut up reach the point where GCC got hurt.
He should have seen I'm not stupid. He should have realized I'm not your
average run-of-the-mill pain in the ass. He should have suspected he was going
to get hurt if he were not careful. He should have realized he was officially
speaking on behalf of the GCC project and should have taken a step back. But,
as I said, the guy just throws himself head on into walls.

I don't say this of the rest of you: you've given me your opinions, and I have
respected them (at least I tried, but I didn't always succeeded as was pointed
out to me about my "opening lines" for this bug report, and I already
apologised for that). So, for the rest of you, I just say you are wrong for
being so confined to C99, but I don't think you are idiots for that.

On top of that I don't know how busy you are, so even after realizing that you
didn't read all my posts and reports thorougly I still cannot blame you for
that. Seen that GCC has many comercial interests behind it I don't even know if
you are getting paid by some company to put up with me or if you are doing it
just for "the fun of it". So I must be understanding, and I tried to be.
Furthermore, I recognize that I must be humble about it and I cannot make any
demands about GCC, so I didn't. And if that is your opinion then tough luck for
me. No sarcasm here either, I agree.

However, if Michael is wrong then he is, in fact, an idiot. I already think he
is an idiot, but if he is wrong then everybody will know it. If this is the
case Michael should recant. He should swallow up his pride and just come out
and admit it. Not for me, but because this matter is much more serious than he
thinks. A lot of people out there trust GCC implicitly, without having read
C99.

If Michael recanted my temptation would be to leave the post in Wikipedia and
add "However, Michael later recanted", just to to screw with him. That would
teach him that once you say it its out there and there is no getting it back.
Maybe teach him to think before saying unsubstantiated crap. Maybe the GCC bug
tracking team would benefit if Michael could learn such a lesson.

However I'm not really a petty guy, and if Michael recanted then, in the spirit
of Wikipedia, the whole post should be removed. And I would do this gladly,
free of charge! :-) Why? If Michael is wrong then developers can, in fact,
trust pointer arithmetic implicitly, so the criticism post in Wikipedia loses
its reason for being (it would no longer be a reason to criticize GCC).

So, what is the bottom line: is Michael right?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45265


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]