public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/64805] New: Specific use of __attribute ((always_inline)) breaks MPX functionality with -fcheck-pointer-bounds -mmpx
@ 2015-01-26 17:07 christian.otterstad at gmail dot com
  2015-01-26 17:19 ` [Bug middle-end/64805] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: christian.otterstad at gmail dot com @ 2015-01-26 17:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64805

            Bug ID: 64805
           Summary: Specific use of __attribute ((always_inline)) breaks
                    MPX functionality with -fcheck-pointer-bounds -mmpx
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: christian.otterstad at gmail dot com

Using the latest git pull of GCC the following program fails to compile:

#include <stdio.h>

static inline void __attribute ((always_inline)) functionA(void)
{
        return;
}

static inline void __attribute ((always_inline)) functionB(void)
{
        functionA();
}

int test(void)
{
        functionB();

        return 0;
}


Attempt at compiling:

attribute_bug.c: In function 'functionB':
attribute_bug.c:18:1: error: Analyzed node has no reference to instrumented
version
 }
 ^
functionB/12 (functionB) @0x7f8d783a8dc8
  Type: function definition analyzed
  Visibility: prevailing_def_ironly
  References: 
  Referring: 
  Availability: local
  First run: 0
  Function flags: body local
  Called by: 
  Calls: 
  Has instrumented version.
attribute_bug.c:18:1: internal compiler error: verify_cgraph_node failed
0x749ab0 cgraph_node::verify_node()
        ../../../temp_git/gcc/gcc/cgraph.c:3096
0x73eab7 symtab_node::verify()
        ../../../temp_git/gcc/gcc/symtab.c:1161
0xb5a089 optimize_inline_calls(tree_node*)
        ../../../temp_git/gcc/gcc/tree-inline.c:4936
0x10dadf8 early_inliner(function*)
        ../../../temp_git/gcc/gcc/ipa-inline.c:2577
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


This is rewritten from code found in glibc, in libc-start.c (it also fails to
compile with the same error).

This may be related to fixes resulting from bug 64363
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64363 , as earlier versions of GCC
supporting -fcheck-pointer-bounds -mmpx do not feature this issue. However
since it is a bug of a different type I'm nevertheless opening a new bug for
this problem.

It appears gcc (GCC) 5.0.0 20150122 and up have this problem (latest version
tested: gcc (GCC) 5.0.0 20150126)

It appears that at least gcc (GCC) 5.0.0 20150107, gcc (GCC) 5.0.0 20150105,
gcc (GCC) 5.0.0 20141218 do not feature this bug.


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

* [Bug middle-end/64805] Specific use of __attribute ((always_inline)) breaks MPX functionality with -fcheck-pointer-bounds -mmpx
  2015-01-26 17:07 [Bug c/64805] New: Specific use of __attribute ((always_inline)) breaks MPX functionality with -fcheck-pointer-bounds -mmpx christian.otterstad at gmail dot com
@ 2015-01-26 17:19 ` mpolacek at gcc dot gnu.org
  2015-01-27  8:49 ` enkovich.gnu at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-01-26 17:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64805

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-01-26
                 CC|                            |mpolacek at gcc dot gnu.org
          Component|c                           |middle-end
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.


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

* [Bug middle-end/64805] Specific use of __attribute ((always_inline)) breaks MPX functionality with -fcheck-pointer-bounds -mmpx
  2015-01-26 17:07 [Bug c/64805] New: Specific use of __attribute ((always_inline)) breaks MPX functionality with -fcheck-pointer-bounds -mmpx christian.otterstad at gmail dot com
  2015-01-26 17:19 ` [Bug middle-end/64805] " mpolacek at gcc dot gnu.org
@ 2015-01-27  8:49 ` enkovich.gnu at gmail dot com
  2015-01-28 21:11 ` hjl.tools at gmail dot com
  2015-04-16 14:04 ` ienkovich at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: enkovich.gnu at gmail dot com @ 2015-01-27  8:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64805

Ilya Enkovich <enkovich.gnu at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |enkovich.gnu at gmail dot com

--- Comment #2 from Ilya Enkovich <enkovich.gnu at gmail dot com> ---
This might be introduced by the recent changes in always_inline functions
instrumentation.  Now we keep them alive longer and therefore have inline of
the original functionA into the original functionB.  It causes error in a
verifier because inliner clears all references and then calls cgraph node
verification which expects IPA_REF_CHKP reference to instrumented functionB.

I would like to keep IPA_REF_CHKP check in the verifier because this ref is
important for reachability analysis.  Thus we probably should rebuild
IPA_REF_CHKP reference in inliner.  Will tests this patch:

diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index c0ff329..d341619 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -2464,6 +2464,13 @@ early_inliner (function *fun)
 #endif
   node->remove_all_references ();

+  /* Rebuild this reference because it dosn't depend on
+     function's body and it's required to pass cgraph_node
+     verification.  */
+  if (node->instrumented_version
+      && !node->instrumentation_clone)
+    node->create_reference (node->instrumented_version, IPA_REF_CHKP, NULL);
+
   /* Even when not optimizing or not inlining inline always-inline
      functions.  */
   inlined = inline_always_inline_functions (node);


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

* [Bug middle-end/64805] Specific use of __attribute ((always_inline)) breaks MPX functionality with -fcheck-pointer-bounds -mmpx
  2015-01-26 17:07 [Bug c/64805] New: Specific use of __attribute ((always_inline)) breaks MPX functionality with -fcheck-pointer-bounds -mmpx christian.otterstad at gmail dot com
  2015-01-26 17:19 ` [Bug middle-end/64805] " mpolacek at gcc dot gnu.org
  2015-01-27  8:49 ` enkovich.gnu at gmail dot com
@ 2015-01-28 21:11 ` hjl.tools at gmail dot com
  2015-04-16 14:04 ` ienkovich at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2015-01-28 21:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64805

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
*** Bug 64804 has been marked as a duplicate of this bug. ***


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

* [Bug middle-end/64805] Specific use of __attribute ((always_inline)) breaks MPX functionality with -fcheck-pointer-bounds -mmpx
  2015-01-26 17:07 [Bug c/64805] New: Specific use of __attribute ((always_inline)) breaks MPX functionality with -fcheck-pointer-bounds -mmpx christian.otterstad at gmail dot com
                   ` (2 preceding siblings ...)
  2015-01-28 21:11 ` hjl.tools at gmail dot com
@ 2015-04-16 14:04 ` ienkovich at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ienkovich at gcc dot gnu.org @ 2015-04-16 14:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64805

Ilya Enkovich <ienkovich at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Ilya Enkovich <ienkovich at gcc dot gnu.org> ---
Fixed


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

end of thread, other threads:[~2015-04-16 14:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26 17:07 [Bug c/64805] New: Specific use of __attribute ((always_inline)) breaks MPX functionality with -fcheck-pointer-bounds -mmpx christian.otterstad at gmail dot com
2015-01-26 17:19 ` [Bug middle-end/64805] " mpolacek at gcc dot gnu.org
2015-01-27  8:49 ` enkovich.gnu at gmail dot com
2015-01-28 21:11 ` hjl.tools at gmail dot com
2015-04-16 14:04 ` ienkovich at gcc dot gnu.org

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