public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55449] New: [4.4.3] pure virtual call only with -O1/2/3 (boost::optional)
@ 2012-11-23 15:44 mendola at gmail dot com
  2012-11-23 16:06 ` [Bug c++/55449] " redi at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: mendola at gmail dot com @ 2012-11-23 15:44 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55449
           Summary: [4.4.3] pure virtual call only with -O1/2/3
                    (boost::optional)
    Classification: Unclassified
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mendola@gmail.com


Created attachment 28765
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28765
test case + preprocessor output

The following code generates a pure virtual method call only when compiled with
-O1/O2/O3, the same code seems working without error with gcc 4.7.3.

The code is inlined in here and I have attached an archive containing the
preprocessor output as well.

Consider that it doesn't crash if:

- Remove the noncopyable from  B
  or
- Remove one of the two segments in the extra scope in main
  or
- Remove the try { } catch 

I have tried with boost 1.40, 1.50 and 1.52 

#include <boost/optional.hpp>
#include <boost/noncopyable.hpp>

class B : boost::noncopyable { //if the noncopyable is removed works
 public:
  virtual size_t bar() const = 0;
};

class D : public B {
 public:
  D()
  :theBar(foo(10))
  {  }

  virtual size_t bar() const {
    return theBar;
  }
 private:
  static size_t foo(const boost::optional<size_t> a) {
    if (a) { //if this is a.is_initialized() then it works
      return a.get();
    }
    return 2;
  }
  const size_t theBar;
};

class Foo {
 public:
  Foo(const B& b)
  :theBar(b.bar() * b.bar())
  { }
 private:
  const size_t theBar;
};

int main()
{
  {  //if this section is removed works
    D d;
    try {
      Foo myCompound(d);
    } catch(...) {}
  }
  {
    D d;
    try {
      Foo myCompound(d);
    } catch(...) {}
  }
}


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/55449] [4.4.3] pure virtual call only with -O1/2/3 (boost::optional)
  2012-11-23 15:44 [Bug c++/55449] New: [4.4.3] pure virtual call only with -O1/2/3 (boost::optional) mendola at gmail dot com
@ 2012-11-23 16:06 ` redi at gcc dot gnu.org
  2012-11-23 16:11 ` paolo.carlini at oracle dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-11-23 16:06 UTC (permalink / raw)
  To: gcc-bugs


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-23 16:06:00 UTC ---
GCC 4.4 is no longer supported, and the problem seems to be already fixed in
current releases.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/55449] [4.4.3] pure virtual call only with -O1/2/3 (boost::optional)
  2012-11-23 15:44 [Bug c++/55449] New: [4.4.3] pure virtual call only with -O1/2/3 (boost::optional) mendola at gmail dot com
  2012-11-23 16:06 ` [Bug c++/55449] " redi at gcc dot gnu.org
@ 2012-11-23 16:11 ` paolo.carlini at oracle dot com
  2012-11-24  6:28 ` mendola at gmail dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-23 16:11 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WORKSFORME

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-23 16:10:47 UTC ---
Closing then.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/55449] [4.4.3] pure virtual call only with -O1/2/3 (boost::optional)
  2012-11-23 15:44 [Bug c++/55449] New: [4.4.3] pure virtual call only with -O1/2/3 (boost::optional) mendola at gmail dot com
  2012-11-23 16:06 ` [Bug c++/55449] " redi at gcc dot gnu.org
  2012-11-23 16:11 ` paolo.carlini at oracle dot com
@ 2012-11-24  6:28 ` mendola at gmail dot com
  2012-11-24  6:37 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mendola at gmail dot com @ 2012-11-24  6:28 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Gaetano Mendola <mendola at gmail dot com> 2012-11-24 06:27:06 UTC ---
Time to adopt ICC.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/55449] [4.4.3] pure virtual call only with -O1/2/3 (boost::optional)
  2012-11-23 15:44 [Bug c++/55449] New: [4.4.3] pure virtual call only with -O1/2/3 (boost::optional) mendola at gmail dot com
                   ` (2 preceding siblings ...)
  2012-11-24  6:28 ` mendola at gmail dot com
@ 2012-11-24  6:37 ` pinskia at gcc dot gnu.org
  2012-11-24  6:57 ` mendola at gmail dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-11-24  6:37 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-11-24 06:37:08 UTC ---
(In reply to comment #3)
> Time to adopt ICC.

There is only so much resources to support older versions of GCC.  If you want
support for older versions of GCC, then you should pay someone (like you do for
ICC).


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/55449] [4.4.3] pure virtual call only with -O1/2/3 (boost::optional)
  2012-11-23 15:44 [Bug c++/55449] New: [4.4.3] pure virtual call only with -O1/2/3 (boost::optional) mendola at gmail dot com
                   ` (3 preceding siblings ...)
  2012-11-24  6:37 ` pinskia at gcc dot gnu.org
@ 2012-11-24  6:57 ` mendola at gmail dot com
  2012-11-24  9:43 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mendola at gmail dot com @ 2012-11-24  6:57 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Gaetano Mendola <mendola at gmail dot com> 2012-11-24 06:57:16 UTC ---
I have no problem to pay someone, I'm a bit disappointed seeing a bug closed
because "new version works" without investigate if the problem is still there
in new versions but not triggered by my test case. 
Also if 4.4.3 is not supported why while submitting the bug I was able to
target the 4.4.3?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/55449] [4.4.3] pure virtual call only with -O1/2/3 (boost::optional)
  2012-11-23 15:44 [Bug c++/55449] New: [4.4.3] pure virtual call only with -O1/2/3 (boost::optional) mendola at gmail dot com
                   ` (4 preceding siblings ...)
  2012-11-24  6:57 ` mendola at gmail dot com
@ 2012-11-24  9:43 ` paolo.carlini at oracle dot com
  2012-11-24 12:03 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-24  9:43 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-24 09:43:14 UTC ---
Let's make a deal: you provide a self-contained short testcase (say below 50
lines, definitely doable with the help of c-reduce or delta) and I add it to
the mainline testsuite, to avoid regressions. I'll do that for free! ;)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/55449] [4.4.3] pure virtual call only with -O1/2/3 (boost::optional)
  2012-11-23 15:44 [Bug c++/55449] New: [4.4.3] pure virtual call only with -O1/2/3 (boost::optional) mendola at gmail dot com
                   ` (5 preceding siblings ...)
  2012-11-24  9:43 ` paolo.carlini at oracle dot com
@ 2012-11-24 12:03 ` redi at gcc dot gnu.org
  2012-11-24 12:25 ` mendola at gmail dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-11-24 12:03 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-24 12:02:56 UTC ---
(In reply to comment #5)
> I have no problem to pay someone, I'm a bit disappointed seeing a bug closed
> because "new version works" without investigate if the problem is still there
> in new versions but not triggered by my test case.

I'm a bit disappointed you think I didn't investigate. I'm a bit disappointed
you didn't try a current release as requested at http://gcc.gnu.org/bugs/ (or
even the most recent 4.4 release!) I'm a bit disappointed you didn't reduce the
testcase to something that doesn't include thousands of lines of boost code.
I'm a bit diappointed you didn't include the output of 'g++ -v'. But I got over
my disappointment and I tested  with half a dozen different versions of GCC and
looked for old bugs in the area which I know about.  I didn't find anything,
but the bug is not reproducible in current releases.  Exactly how much time do
you expect someone to spend chasing a bug that doesn't appear to exist any
more?

If you can reproduce it with a current release then reopen the bug, otherwise
this is a bug in a release series that is discontinued and not going to be
fixed.

If you pay me I'll find exactly which patch fixed it, otherwise the onus is on
you to demonstrate there's still a problem.

> Also if 4.4.3 is not supported why while submitting the bug I was able to
> target the 4.4.3?

There are lots of existing bugs with that version, so it has to be a valid
option, or we'd have to delete all the old bugs. We could make it unselectable,
but that would prevent us fixing or re-categorising old bugs if we need to, and
is it really worth the effort of customising bugzilla in that way?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/55449] [4.4.3] pure virtual call only with -O1/2/3 (boost::optional)
  2012-11-23 15:44 [Bug c++/55449] New: [4.4.3] pure virtual call only with -O1/2/3 (boost::optional) mendola at gmail dot com
                   ` (6 preceding siblings ...)
  2012-11-24 12:03 ` redi at gcc dot gnu.org
@ 2012-11-24 12:25 ` mendola at gmail dot com
  2012-11-24 14:21 ` redi at gcc dot gnu.org
  2012-11-24 17:49 ` mendola at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: mendola at gmail dot com @ 2012-11-24 12:25 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #8 from Gaetano Mendola <mendola at gmail dot com> 2012-11-24 12:25:35 UTC ---
Jonathan, I have nothing against you personaly, what you wrote is:

"GCC 4.4 is no longer supported, and the problem *seems* to be already fixed in
current releases."

and doesn't exactly show that you have investigate, I have also stated that
with 4.7.3 works.

Actualy the code I have submitted was tailored already I couldn't shrink more
than I did. To be honest with the real code instead to have a "pure virtual
call" I had a simple core with gdb finding bogus data in the core, that was the
smallest test I was able to make it reproducible.

About the fact I didn't post the g++ -v output you are right, I have issued the
command "g++ -v -save-temps ..." but somehow the output get lost in the archive
attached. If you are interested in the output I will provide it. About the fact
to pay you to find the patch/commit correcting it just send me a commercial
proposal to my email address.

Thank you for your time.

Regards
Gaetano Mendola


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/55449] [4.4.3] pure virtual call only with -O1/2/3 (boost::optional)
  2012-11-23 15:44 [Bug c++/55449] New: [4.4.3] pure virtual call only with -O1/2/3 (boost::optional) mendola at gmail dot com
                   ` (7 preceding siblings ...)
  2012-11-24 12:25 ` mendola at gmail dot com
@ 2012-11-24 14:21 ` redi at gcc dot gnu.org
  2012-11-24 17:49 ` mendola at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-11-24 14:21 UTC (permalink / raw)
  To: gcc-bugs


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.5.0

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-24 14:21:12 UTC ---
(In reply to comment #8)
> Jonathan, I have nothing against you personaly, what you wrote is:
> 
> "GCC 4.4 is no longer supported, and the problem *seems* to be already fixed in
> current releases."
> 
> and doesn't exactly show that you have investigate, I have also stated that
> with 4.7.3 works.

I investigated and couldn't find anything conclusive, so I said "seems" because
I wasn't certain.

If you assume I didn't investigate and reply with "time to adopt ICC" then feel
free to do so, I don't volunteer my time to GCC for people with that attitude.

> Actualy the code I have submitted was tailored already I couldn't shrink more
> than I did. To be honest with the real code instead to have a "pure virtual
> call" I had a simple core with gdb finding bogus data in the core, that was the
> smallest test I was able to make it reproducible.

http://gcc.gnu.org/bugs/minimize.html
http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction

> About the fact I didn't post the g++ -v output you are right, I have issued the
> command "g++ -v -save-temps ..." but somehow the output get lost in the archive
> attached. If you are interested in the output I will provide it.

I'm not interested, the point is you provided an incomplete bug report but are
then happy to complain about the effort put in by people who look at it.

The bug was fixed by http://gcc.gnu.org/ml/gcc-cvs/2009-04/msg00115.html so is
fixed in 4.5.0 and later


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/55449] [4.4.3] pure virtual call only with -O1/2/3 (boost::optional)
  2012-11-23 15:44 [Bug c++/55449] New: [4.4.3] pure virtual call only with -O1/2/3 (boost::optional) mendola at gmail dot com
                   ` (8 preceding siblings ...)
  2012-11-24 14:21 ` redi at gcc dot gnu.org
@ 2012-11-24 17:49 ` mendola at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: mendola at gmail dot com @ 2012-11-24 17:49 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #10 from Gaetano Mendola <mendola at gmail dot com> 2012-11-24 17:49:41 UTC ---
(In reply to comment #9)
> (In reply to comment #8)
> > Jonathan, I have nothing against you personaly, what you wrote is:
> > 
> > "GCC 4.4 is no longer supported, and the problem *seems* to be already fixed in
> > current releases."
> > 
> > and doesn't exactly show that you have investigate, I have also stated that
> > with 4.7.3 works.
> 
> I investigated and couldn't find anything conclusive, so I said "seems" because
> I wasn't certain.
> 
> If you assume I didn't investigate and reply with "time to adopt ICC" then feel
> free to do so, I don't volunteer my time to GCC for people with that attitude.

Well, I have to admit that was a poor and over reacted reply from my side, but
as 
you spent your time to investigate the issue I have spent my time to understand
why 
it was happening and some hours, no kidding, to shrink it as much I could to
create 
the test case I have submitted, as you can see that code is useful to nothing.

I was frustrated to see a short "it work/fixed in current release" after having
work
half noon to submit it, the fast it was working with a new gcc release was an 
information I already knew it, I'd expect something on the line: "o yes, it was
an
old bug we have already corrected", that's why I have submitted the bug not to
drive
someone else trying the same I did.

As you can see from my first post I have tried to shrink more than that, and
each 
piece I was removing was then making the test "passing".

> I'm not interested, the point is you provided an incomplete bug report but are
> then happy to complain about the effort put in by people who look at it.

I'm not happy to complain, why would I? I'm happy when stuff works and when 
a submitted bug was a real bug helping to improve gcc quality.

When I submitted it, for me the bug report was not incomplete otherwise I
wouldn't 
have submitted it, I did follow the guide and the only piece missing, my fault, 
was the output of g++ -v -save-temps because I forgot to redirect the output to
a 
file. I would have provided it immediately if you would have pointed it out
earlier.

> The bug was fixed by http://gcc.gnu.org/ml/gcc-cvs/2009-04/msg00115.html so is
> fixed in 4.5.0 and later

Thank you for it. May I say now then: "time to upgrade gcc" ?

I'm sorry it was not my intention to hurt anyone.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-11-24 17:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-23 15:44 [Bug c++/55449] New: [4.4.3] pure virtual call only with -O1/2/3 (boost::optional) mendola at gmail dot com
2012-11-23 16:06 ` [Bug c++/55449] " redi at gcc dot gnu.org
2012-11-23 16:11 ` paolo.carlini at oracle dot com
2012-11-24  6:28 ` mendola at gmail dot com
2012-11-24  6:37 ` pinskia at gcc dot gnu.org
2012-11-24  6:57 ` mendola at gmail dot com
2012-11-24  9:43 ` paolo.carlini at oracle dot com
2012-11-24 12:03 ` redi at gcc dot gnu.org
2012-11-24 12:25 ` mendola at gmail dot com
2012-11-24 14:21 ` redi at gcc dot gnu.org
2012-11-24 17:49 ` mendola at gmail dot com

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).