From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7140 invoked by alias); 21 Jul 2005 19:53:43 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 7133 invoked by uid 48); 21 Jul 2005 19:53:40 -0000 Date: Thu, 21 Jul 2005 19:54:00 -0000 From: "eda-qa at disemia dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20050721195339.22597.eda-qa@disemia.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/22597] New: pure attribute produces incorrect results X-Bugzilla-Reason: CC X-SW-Source: 2005-07/txt/msg02622.txt.bz2 List-Id: In the attached code the pure attribute is causing the result to be random/junk on the final calculation in main. According to the docs the function seems to qualify for pure status -- it uses only the parameters given. It does however create a temporary (but as this exists on the stack I assumed it is okay, since it still doesn't violate the notion of being pure). Expected result (with -DNOATTRIB or -DNOCOPYCTOR flags): 5, 5 1, 1 Actual Result (compiled with g++ -o test point_err.cc): 5, 5 338848, 4.85849e-270 (NOTE: Worked on 3.3) It is curious also that no declaring the copy constructor also allows this code to work with the pure attribute. So, either this is a bug in the 4.0 "pure" handling, or the documentation for "pure" is omitting some vital point which my code violates. -- Summary: pure attribute produces incorrect results Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: eda-qa at disemia dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22597