public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58063] default arguments evaluated twice per call
Date: Sat, 03 Aug 2013 21:23:00 -0000	[thread overview]
Message-ID: <bug-58063-4-0IuAFA9wFI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58063-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to Paolo Carlini from comment #5)
> Ah, in case isn't obvious already: it only happens when the "I/O expression"
> has the ! operator in front.

I suspected that and ensured that I added a similar operator! to my ostream
model type, but this hadn't any impact on the outcome for that type. Further, I
don't understand how it is related to ostream initialization, because the issue
also occurs when we invert the order of the function calls:

int main() {
 f2();
 std::cout << "------------------\n";
 f();
}

gives me:

<quote>
hi!
0
------------------
hi!
hi!
0
</quote>

Are you sure that this is not due to improper code generation?
>From gcc-bugs-return-427294-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Aug 03 21:31:00 2013
Return-Path: <gcc-bugs-return-427294-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 13827 invoked by alias); 3 Aug 2013 21:31:00 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 13732 invoked by uid 48); 3 Aug 2013 21:30:58 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58063] default arguments evaluated twice per call
Date: Sat, 03 Aug 2013 21:31:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-58063-4-6aM430M4Rm@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58063-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58063-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-08/txt/msg00218.txt.bz2
Content-length: 361

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX063

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I'm not at all sure! But it happens with -O0 too, right?, thus at this point
the front-end seems more likely than the back-end, I would not change the
Component from c++ to something else. In any case we badly need a reduced
testcase ;)


  parent reply	other threads:[~2013-08-03 21:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-02 20:38 [Bug c++/58063] New: " plokinom at gmail dot com
2013-08-03 20:40 ` [Bug c++/58063] " paolo.carlini at oracle dot com
2013-08-03 20:48 ` daniel.kruegler at googlemail dot com
2013-08-03 20:58 ` paolo.carlini at oracle dot com
2013-08-03 21:23 ` daniel.kruegler at googlemail dot com [this message]
2013-08-03 21:34 ` daniel.kruegler at googlemail dot com
2013-08-04 12:11 ` fanael4 at gmail dot com
2013-08-04 12:22 ` paolo.carlini at oracle dot com
2015-06-14 18:02 ` plokinom at gmail dot com
2015-06-16 19:29 ` jason at gcc dot gnu.org
2015-06-17 14:33 ` jason at gcc dot gnu.org
2015-06-21  9:06 ` ville.voutilainen at gmail dot com
2015-08-18 14:44 ` jason at gcc dot gnu.org

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=bug-58063-4-0IuAFA9wFI@http.gcc.gnu.org/bugzilla/ \
    --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: link
Be 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).