[Bug c/64805] New: Specific use of __attribute ((always_inline)) breaks MPX functionality with -fcheck-pointer-bounds -mmpx

2015-01-26 Thread christian.otterstad at gmail dot com
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 

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.


[Bug target/64363] Unresolved labels with -fcheck-pointer-bounds and -mmpx

2015-01-26 Thread christian.otterstad at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64363

--- Comment #3 from Christian Otterstad  
---
Great, it seems this corrected the issue, but a new problem that didn't appear
to exist before seems to have been introduced. I created a new bug issue for
it. Bug 64805: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64805


[Bug c/64363] New: Unresolved labels with -fcheck-pointer-bounds and -mmpx

2014-12-19 Thread christian.otterstad at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64363

Bug ID: 64363
   Summary: Unresolved labels with -fcheck-pointer-bounds and
-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

I believe there is a problem with the -fcheck-pointer-bounds and -mmpx
arguments for GCC.

gcc test.c -c -std=gnu99 -O2 -Wall -fcheck-pointer-bounds -g -mmpx
/tmp/ccugNfJ8.s: Assembler messages:
/tmp/ccugNfJ8.s:67: Error: can't resolve `.L5' {*UND* section} - `.L6' {*UND*
section}

For the following source:


#include 

int main(int argc, char **argv)
{
static int array = &&label_B - &&label_A;

label_A:

printf("%d\n", array);

label_B:

return 0;
}


This is derived from code found in vfprintf.c in glibc (after a lot of
rewriting). Attempting to compile glibc results in numerous such errors ("can't
resolve") of the same type. Omitting -fcheck-pointer-bounds and -mmpx allows it
(and all of glibc as well) to compile without errors.

Part of the following assembly generated (using -S) is given here:

__chkp_zero_bounds:
.zero   16
.data
.align 4
.type   array.2314, @object
.size   array.2314, 4
array.2314:
.long   .L5-.L6
.section.text.unlikely

No AS version appears to be able to assemble this, as .L5, .L6 doesn't exist
anywhere in the assembly source file.


At least the following versions appear to have this problem:

gcc (GCC) 5.0.0 20141211 (experimental) using GNU assembler (Gentoo 2.24 p1.4)
2.24
gcc (GCC) 5.0.0 20141215 (experimental) using GNU assembler (Gentoo 2.24 p1.4)
2.24
gcc (GCC) 5.0.0 20141216 (experimental) using GNU assembler (Gentoo 2.24 p1.4)
2.24
gcc (GCC) 5.0.0 20141216 (experimental) using GNU assembler (GNU Binutils)
2.25.51.20141215
gcc (GCC) 5.0.0 20141216 (experimental) using GNU assembler (GNU Binutils)
2.25.51.20141216
gcc (GCC) 5.0.0 20140925 (experimental) using GNU assembler (GNU Binutils)
2.24.51.20140422
gcc (GCC) 5.0.0 20141218 (experimental) using GNU assembler (Gentoo 2.24 p1.4)


Please note that gcc (GCC) 5.0.0 20140925 (experimental) is the same version
provided by Intel (in both source and binary form) to be used experimentally
with MPX.
https://software.intel.com/en-us/articles/intel-software-development-emulator
However I've also tried these other versions to see if the issue happened to be
resolved.