public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rogerio at rilhas dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/45249] Indirect variable parameters sometimes cause segmentation fault Date: Wed, 11 Aug 2010 22:35:00 -0000 [thread overview] Message-ID: <20100811223509.31883.qmail@sourceware.org> (raw) In-Reply-To: <bug-45249-19547@http.gcc.gnu.org/bugzilla/> ------- Comment #38 from rogerio at rilhas dot com 2010-08-11 22:35 ------- (In reply to comment #34) > (In reply to comment #25) > > In other words my code is not portable because GCC is not doing what it should. > > GCC causes code not to be portable a lot of times, like in the following case > > (which does not compile because of GCC's shortcommings): > > > > class Temp { > > public: > > Temp(int b); > > Temp(Temp& t); > > void operator=(Temp& t); > > }; > > > > void func(int a, class Temp& b, int c); > > > > func(10, Temp(20), 30); // error > ISO/IEC 14882:2003(E) 8.5.3 [dcl.init.ref] paragraph 5 Thanks for this. I didn't know why GCC was unable to compile such code and now I know: GCC is unable to convert a initialization passed as parameter to an lvalue. Microsoft's compiler does know how to do that - there is no problem in getting the address of such temporary variables, right? Oh, wrong, GCC can't, that's just too hard on the poor thing. ... oh well, let's just not call that a portability issue created by GCC, because no one explained to its developers how to get the address of a temporary variable. Let's just not initialize temporary variables and stick to the lowest common denominator, which is GCC. Really?? Was that rally the explanation you wanted to provide??? I think its just embarassing. Note that I didn't open a bug for this issue because I can, in fact, reduce to the lowest common denominator. So, I can live without (although not as confortably). > > This code does not compile in GCC, and so is not portable. That's shortcomming > > of GCC that makes my code be not portable, not me. Its GCC's fault that code > > that invokes Temp(20) as a parameter is not portable, not the programmer's > > fault. > ibid. > > Unfortunately, conversations like this one show that GCC will never be perfect, > > because people like you will insist that the compiler doesn't need to do what I > > said it should (even when facing the obvious references that I've posted), and > > prove that page 70 is right about warning programmers not to rely on compilers > > to do correct parameter placements. > What a charming idea, that a compiler could become perfect by doing "what I > said it should" You must have missed something in the discussion because you failed to see that "what I say" is what "C99+cdecl" say. Please forgive me for cutting sentences short, I didn't think anyone would start making comments without reading the whole conversation, my bad. ... is it still a charming idea after you read all the backups to my claims? > > My personal experience is that GCC is the cause for such portability problems. > > You still insist that GCC doesn't need to improve in this respect, and that > > shows why GCC will never be as good as other compilers. Microsoft, for example, > > appreciates comments like mine because it helps them improve the product, but > > you just want to dismiss it as bad code on my part. I know Microsoft's people > > get paid to do so, but, still, I'm talking about the right mind set. > Oh, how delightfully quaint! It is, isn't it? And it makes sense too, doesn't it? I bet that thinking that GCC needs not improve on the stuff I commented here is a sure way to get you there fast. I'm sorry I even tried! -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45249
next prev parent reply other threads:[~2010-08-11 22:35 UTC|newest] Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-08-10 21:55 [Bug c++/45249] New: " rogerio at rilhas dot com 2010-08-10 22:03 ` [Bug c++/45249] " rogerio at rilhas dot com 2010-08-10 22:04 ` rogerio at rilhas dot com 2010-08-10 22:04 ` rogerio at rilhas dot com 2010-08-10 22:07 ` pinskia at gcc dot gnu dot org 2010-08-10 22:33 ` rogerio at rilhas dot com 2010-08-10 22:36 ` rogerio at rilhas dot com 2010-08-10 23:08 ` pinskia at gcc dot gnu dot org 2010-08-11 0:55 ` rogerio at rilhas dot com 2010-08-11 0:58 ` pinskia at gcc dot gnu dot org 2010-08-11 1:57 ` rogerio at rilhas dot com 2010-08-11 3:52 ` pinskia at gcc dot gnu dot org 2010-08-11 11:21 ` rogerio at rilhas dot com 2010-08-11 11:21 ` rogerio at rilhas dot com 2010-08-11 11:22 ` rogerio at rilhas dot com 2010-08-11 11:37 ` rguenth at gcc dot gnu dot org 2010-08-11 11:41 ` rguenth at gcc dot gnu dot org 2010-08-11 11:55 ` redi at gcc dot gnu dot org 2010-08-11 13:12 ` rogerio at rilhas dot com 2010-08-11 14:10 ` redi at gcc dot gnu dot org 2010-08-11 16:11 ` matz at gcc dot gnu dot org 2010-08-11 17:04 ` rogerio at rilhas dot com 2010-08-11 17:15 ` rogerio at rilhas dot com 2010-08-11 17:49 ` pinskia at gcc dot gnu dot org 2010-08-11 17:57 ` redi at gcc dot gnu dot org 2010-08-11 19:51 ` rogerio at rilhas dot com 2010-08-11 19:54 ` pinskia at gcc dot gnu dot org 2010-08-11 20:04 ` rogerio at rilhas dot com 2010-08-11 20:07 ` rogerio at rilhas dot com 2010-08-11 20:33 ` rguenth at gcc dot gnu dot org 2010-08-11 20:58 ` rogerio at rilhas dot com 2010-08-11 21:02 ` pinskia at gcc dot gnu dot org 2010-08-11 21:12 ` rogerio at rilhas dot com 2010-08-11 21:16 ` pinskia at gcc dot gnu dot org 2010-08-11 21:27 ` redi at gcc dot gnu dot org 2010-08-11 22:17 ` rogerio at rilhas dot com 2010-08-11 22:27 ` rguenth at gcc dot gnu dot org 2010-08-11 22:31 ` rguenth at gcc dot gnu dot org 2010-08-11 22:35 ` rogerio at rilhas dot com [this message] 2010-08-11 22:37 ` rogerio at rilhas dot com 2010-08-11 22:48 ` rguenth at gcc dot gnu dot org 2010-08-11 22:50 ` rogerio at rilhas dot com 2010-08-11 22:51 ` rogerio at rilhas dot com 2010-08-11 22:52 ` rogerio at rilhas dot com 2010-08-11 22:53 ` rogerio at rilhas dot com 2010-08-11 22:54 ` rogerio at rilhas dot com 2010-08-11 22:54 ` rogerio at rilhas dot com 2010-08-11 22:55 ` rogerio at rilhas dot com 2010-08-11 22:58 ` pinskia at gcc dot gnu dot org 2010-08-11 23:22 ` rogerio at rilhas dot com 2010-08-11 23:43 ` rogerio at rilhas dot com 2010-08-12 2:08 ` rogerio at rilhas dot com 2010-08-12 2:10 ` rogerio at rilhas dot com 2010-08-12 2:11 ` rogerio at rilhas dot com 2010-08-12 2:12 ` rogerio at rilhas dot com 2010-08-12 2:13 ` rogerio at rilhas dot com 2010-08-12 8:20 ` jakub at gcc dot gnu dot org 2010-08-12 10:17 ` rogerio at rilhas dot com 2010-08-12 10:18 ` paolo dot carlini at oracle dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20100811223509.31883.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).