public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: peteb@sitera.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/1833: inlining sometimes causes incorrect behavior
Date: Sun, 01 Apr 2001 00:00:00 -0000	[thread overview]
Message-ID: <20010201192239.7990.qmail@sourceware.cygnus.com> (raw)

>Number:         1833
>Category:       c++
>Synopsis:       inlining sometimes causes incorrect behavior
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 01 11:26:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Peter Bartlett
>Release:        gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:

>Description:
The attached program calls two versions of a function,
one inlined and the other not. The inlined function does
not behave correctly. The type casting of a (char *)
argument to (const char *) as an argument to another funtion
that takes (const char *&) does not properly modify the
argument in the calling function in the inlined version.
>How-To-Repeat:
#include <iostream>


void frob2 (const char*& s)
{
  s += 3;
}


inline void frob_fail (char *s)
{
  frob2((const char *)s);

  cerr << "should be 34567: " << s << endl;
}


void frob_pass (char *s)
{
  frob2((const char *)s);

  cerr << "should be 34567: " << s << endl;
}


int main (unsigned argc, const char *const argv[])
{
  char *x = "01234567";
  frob_fail(x);

  char *y = "01234567";
  frob_pass(y);
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
>From David.Billinghurst@riotinto.com Sun Apr 01 00:00:00 2001
From: "Billinghurst, David \(CRTS\)" <David.Billinghurst@riotinto.com>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org
Subject: re: c/1872
Date: Sun, 01 Apr 2001 00:00:00 -0000
Message-id: <20010205234601.11151.qmail@sourceware.cygnus.com>
X-SW-Source: 2001-q1/msg00983.html
Content-length: 780

The following reply was made to PR c/1872; it has been noted by GNATS.

From: "Billinghurst, David (CRTS)" <David.Billinghurst@riotinto.com>
To: "'gcc-gnats@gcc.gnu.org'" <gcc-gnats@gcc.gnu.org>,
        "Billinghurst, David (CRTS)" <David.Billinghurst@riotinto.com>,
        "'nobody@gcc.gnu.org'" <nobody@gcc.gnu.org>
Cc:  
Subject: re: c/1872
Date: Mon, 5 Feb 2001 23:38:32 -0000 

 This can be closed.  
 
 Fixed by:
 
 Mon Feb  5 11:23:16 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
 	* config/mips/mips.c (override_options): Fix typo in last change.
 	(mips_make_temp_file): Call fatal_io_error, not pfatal_with_name.
 	(mips_asm_file_end): Likewise; also pass more args to
 fatal_io_error.
 
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=1872&database=gcc
>From neil@gcc.gnu.org Sun Apr 01 00:00:00 2001
From: neil@gcc.gnu.org
To: egcs@cygnus.com
Cc: gcc-prs@gcc.gnu.org
Subject: Re: c++/1688
Date: Sun, 01 Apr 2001 00:00:00 -0000
X-SW-Source: 2001-q1/msg02357.html
Content-length: 0


             reply	other threads:[~2001-04-01  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-01  0:00 peteb [this message]
2002-10-30 17:26 Wolfgang Bangerth
2002-11-20 18:56 Wolfgang Bangerth

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=20010201192239.7990.qmail@sourceware.cygnus.com \
    --to=peteb@sitera.com \
    --cc=gcc-gnats@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).