public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug regression/19813] [4.0 Regression] wrong code with -finline-limit
Date: Tue, 15 Feb 2005 21:15:00 -0000	[thread overview]
Message-ID: <20050215155349.14352.qmail@sourceware.org> (raw)
In-Reply-To: <20050207230934.19813.ctsa@u.washington.edu>


------- Additional Comments From jakub at gcc dot gnu dot org  2005-02-15 15:53 -------
The bug is the infamous RTX_UNCHANGING_P, apparently still not dead.
Well, now under the MEM_READONLY_P name.

The problem is that set_mem_attributes_minus_bitpos:

1532          tree base = get_base_address (t);
1533          if (base && DECL_P (base)
1534              && TREE_READONLY (base)
1535              && (TREE_STATIC (base) || DECL_EXTERNAL (base)))
1536            MEM_READONLY_P (ref) = 1;

marks as MEM_READONLY_P even something that definitely is not readonly
in the sense now documented in rtl.texi.
main::b is TREE_READONLY, TREE_STATIC, but also e.g. TYPE_NEEDS_CONSTRUCTING.
This variable is initialized to all zeros and then constructed
(several fields to 0 which perhaps could be optimized out) and
main::b._M_t._M_impl._M_header._M_left plus
main::b._M_t._M_impl._M_header._M_right initially to &main::b._M_t.
Then insert_unique is called 2 times to add fields to it.
But because of the MEM_READONLY_P flag the RTL optimizers
just assume that because it was initially set as
main::b._M_t._M_impl._M_header._M_right = &main::b._M_t;
then it will always have that value, so
  struct _Rb_tree_node_base * D.14743;
  D.14743 = b._M_t._M_impl._M_header._M_right;
  if (strcmp (*&((struct _Rb_tree_node<const char*> *) D.14743)->_M_value_field,
D.14710) >= 0) goto <L39>; else goto <L40>;
is mis-optimized into
strcmp (main::b._M_t._M_impl._M_node_count, something);
(_M_value_field is in the same position in _RB_tree_node's as in
_M_node_count in _Rb_tree).

Now, I wonder if we want a target hook here that will be called in
addition to the above checks for MEM_READONLY_P setting and if so, what
exact C++ classes with non-trivial constructors are guaranteed to not
modify memory after relocation processing.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org


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


  parent reply	other threads:[~2005-02-15 15:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-08 10:42 [Bug c++/19813] New: gcc 4.0 regression: bad code generation?? due to inlining?? ctsa at u dot washington dot edu
2005-02-08 12:00 ` [Bug c++/19813] " ctsa at u dot washington dot edu
2005-02-08 13:24 ` [Bug regression/19813] [4.0 Regression] " pinskia at gcc dot gnu dot org
2005-02-08 13:27 ` pinskia at gcc dot gnu dot org
2005-02-09  4:11 ` neroden at gcc dot gnu dot org
2005-02-09  6:42 ` bangerth at dealii dot org
2005-02-09  6:51 ` [Bug regression/19813] [4.0 Regression] wrong code with -finline-limit bangerth at dealii dot org
2005-02-09  8:51 ` pinskia at gcc dot gnu dot org
2005-02-09  9:19 ` pinskia at gcc dot gnu dot org
2005-02-15 21:09 ` jakub at gcc dot gnu dot org
2005-02-15 21:15 ` jakub at gcc dot gnu dot org [this message]
2005-02-15 21:18 ` jakub at gcc dot gnu dot org
2005-02-15 21:20 ` jakub at gcc dot gnu dot org
2005-02-15 21:46 ` [Bug c++/19813] " rth at gcc dot gnu dot org
2005-02-16 16:59 ` jakub at gcc dot gnu dot org
2005-02-18 16:16 ` cvs-commit at gcc dot gnu dot org
2005-02-18 16:27 ` jakub at gcc dot gnu dot 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=20050215155349.14352.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: 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).