Bug 46912 - [4.6 Regression] Test failures for g++.dg/plugin/*plugin*.C on powerpc-apple-darwin9
Summary: [4.6 Regression] Test failures for g++.dg/plugin/*plugin*.C on powerpc-apple...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: testsuite (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-12 17:47 UTC by Dominique d'Humieres
Modified: 2011-01-09 13:02 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-12-13 08:25:45


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominique d'Humieres 2010-12-12 17:47:00 UTC
On powerpc-apple-darwin9 , between revisions 166301 and 166355 (see
http://gcc.gnu.org/ml/gcc-testresults/2010-11/msg00318.html
http://gcc.gnu.org/ml/gcc-testresults/2010-11/msg00432.html )
the following failures appeared:

FAIL: g++.dg/plugin/attribute_plugin-test-1.C -fplugin=./attribute_plugin.so  (test for warnings, line )
FAIL: g++.dg/plugin/attribute_plugin-test-1.C -fplugin=./attribute_plugin.so  (test for warnings, line 7)
FAIL: g++.dg/plugin/attribute_plugin-test-1.C -fplugin=./attribute_plugin.so  (test for warnings, line 7)
FAIL: g++.dg/plugin/attribute_plugin-test-1.C -fplugin=./attribute_plugin.so  (test for warnings, line 16)
FAIL: g++.dg/plugin/attribute_plugin-test-1.C -fplugin=./attribute_plugin.so (test for excess errors)
FAIL: g++.dg/plugin/pragma_plugin-test-1.C -fplugin=./pragma_plugin.so  (test for warnings, line )
FAIL: g++.dg/plugin/pragma_plugin-test-1.C -fplugin=./pragma_plugin.so  (test for warnings, line 5)
FAIL: g++.dg/plugin/pragma_plugin-test-1.C -fplugin=./pragma_plugin.so  (test for warnings, line 9)
FAIL: g++.dg/plugin/pragma_plugin-test-1.C -fplugin=./pragma_plugin.so  (test for warnings, line 14)
FAIL: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 10)
FAIL: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 14)
FAIL: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 18)
FAIL: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 19)
FAIL: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 24)
FAIL: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 50)
FAIL: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 50)
FAIL: g++.dg/tree-prof/indir-call-prof.C compilation,  -g  -fprofile-use

From the log file, the errors are

output is:
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/attribute_plugin-test-1.C:4:55: warning: 'user' attribute directive ignored [-Wattributes]
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/attribute_plugin-test-1.C:5:63: warning: 'user' attribute directive ignored [-Wattributes]
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/attribute_plugin-test-1.C:11:52: warning: 'user' attribute directive ignored [-Wattributes]

FAIL: g++.dg/plugin/attribute_plugin-test-1.C -fplugin=./attribute_plugin.so  (test for warnings, line )
FAIL: g++.dg/plugin/attribute_plugin-test-1.C -fplugin=./attribute_plugin.so  (test for warnings, line 7)
FAIL: g++.dg/plugin/attribute_plugin-test-1.C -fplugin=./attribute_plugin.so  (test for warnings, line 7)
FAIL: g++.dg/plugin/attribute_plugin-test-1.C -fplugin=./attribute_plugin.so  (test for warnings, line 16)
FAIL: g++.dg/plugin/attribute_plugin-test-1.C -fplugin=./attribute_plugin.so (test for excess errors)
Excess errors:
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/attribute_plugin-test-1.C:4:55: warning: 'user' attribute directive ignored [-Wattributes]
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/attribute_plugin-test-1.C:5:63: warning: 'user' attribute directive ignored [-Wattributes]
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/attribute_plugin-test-1.C:11:52: warning: 'user' attribute directive ignored [-Wattributes]

---- no output

FAIL: g++.dg/plugin/pragma_plugin-test-1.C -fplugin=./pragma_plugin.so  (test for warnings, line )
FAIL: g++.dg/plugin/pragma_plugin-test-1.C -fplugin=./pragma_plugin.so  (test for warnings, line 5)
FAIL: g++.dg/plugin/pragma_plugin-test-1.C -fplugin=./pragma_plugin.so  (test for warnings, line 9)
FAIL: g++.dg/plugin/pragma_plugin-test-1.C -fplugin=./pragma_plugin.so  (test for warnings, line 14)

----

output is:
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C: In function 'void __static_initialization_and_destruction_0(int, int)':
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C:50:1: warning: Analyze function __static_initialization_and_destruction_0 [enabled by default]
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C: In constructor 'Foo::Foo()':
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C:50:1: warning: Analyze function __comp_ctor  [enabled by default]
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C: In member function 'void Foo::setA(int)':
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C:50:1: warning: Analyze function setA [enabled by default]
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C: In member function 'void Foo::operator=(Foo&)':
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C:50:1: warning: Analyze function operator= [enabled by default]
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C: In function 'int func()':^M
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C:50:1: warning: Analyze function func [enabled by default]
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C: In function '(static initializers for /opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C)':
/opt/gcc/gcc-4.6-work/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C:50:1: warning: Analyze function _GLOBAL__I_dumb_plugin_test_1.C [enabled by default]

FAIL: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 10)
FAIL: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 14)
FAIL: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 18)
FAIL: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 19)
FAIL: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 24)
FAIL: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 50)
PASS: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 50)
FAIL: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so  (test for warnings, line 50)
PASS: g++.dg/plugin/dumb-plugin-test-1.C -fplugin=./dumb_plugin.so (test for excess errors)
Comment 1 Iain Sandoe 2010-12-13 08:25:45 UTC
this problem is revealed by my commit of:
http://gcc.gnu.org/ml/gcc-cvs/2010-11/msg00188.html

However, it is _not_ caused by it 
(the plugins were not being built before owing to the clash between -mdynamic-no-pic and -fPIC).

The problem in the failing test-cases is that the plugin (which built without flagging faults) does not load.

The plugin does not load because it fails to resolve symbols (IIRC, they are related to the warning subsystem).

Another oddity is that (last time I tried) the faults do not manifest when the compiler is bootstrapped with cxx -- implying that the issue might be related to name mangling or headers.
Comment 2 Iain Sandoe 2010-12-14 21:45:13 UTC
it's all fall-out from the different assumed sizes of Bool (see also 46902).

I think (subject to Mike's agreement) that, since Darwin's <stdbool.h> does not set bool to int for GCC > 3 ... that we should default to one byte bools on PPC darwin (there is no effect on x86).

Index: gcc/config/darwin.opt
===================================================================
--- gcc/config/darwin.opt       (revision 167812)
+++ gcc/config/darwin.opt       (working copy)
@@ -166,7 +166,7 @@ Target Joined Report Var(darwin_macosx_version_min
 The earliest MacOS X version on which this program will run
 
 mone-byte-bool
-Target RejectNegative Report Var(darwin_one_byte_bool)
+Target RejectNegative Report Var(darwin_one_byte_bool) Init(1)
 Set sizeof(bool) to 1
 
 fapple-kext
Comment 3 Mike Stump 2010-12-16 21:59:44 UTC
> it's all fall-out from the different assumed sizes of Bool (see also 46902).

?  bool/_Bool is 4 on pcc.  Making it any other size introduces a abi bug.  What code assumes _Bool is 1 byte?  That would be the root cause that needs fixing.


> I think (subject to Mike's agreement) that, since Darwin's <stdbool.h> does not
> set bool to int for GCC > 3

You're misreading it:

$ cat  t.c
int sz = sizeof(_Bool);
$ gcc -arch ppc t.c -S -o -
	.machine ppc7400
_sz:
	.long	4

> .. that we should default to one byte bools on PPC darwin (there is no effect on x86).

No, that would be bad.
Comment 4 Iain Sandoe 2010-12-16 22:05:55 UTC
(In reply to comment #3)
> > it's all fall-out from the different assumed sizes of Bool (see also 46902).
> 
> ?  bool/_Bool is 4 on pcc.  Making it any other size introduces a abi bug. 
> What code assumes _Bool is 1 byte?  That would be the root cause that needs
> fixing.

Hm. I'm not sure where to go from here .. this touches everything.

gcc/system.h :

/* Provide a fake boolean type.  We make no attempt to use the
   C99 _Bool, as it may not be available in the bootstrap compiler,
   and even if it is, it is liable to be buggy.
   This must be after all inclusion of system headers, as some of
   them will mess us up.  */

#undef TRUE
#undef FALSE

#ifdef __cplusplus
  /* Obsolete.  */
# define TRUE true
# define FALSE false
#else /* !__cplusplus */
# undef bool
# undef true
# undef false

# define bool unsigned char
# define true 1
# define false 0

  /* Obsolete.  */
# define TRUE true
# define FALSE false
#endif /* !__cplusplus */
Comment 5 Mike Stump 2010-12-16 22:42:34 UTC
On Dec 16, 2010, at 2:06 PM, iains at gcc dot gnu.org wrote:
> gcc/system.h :

> # define bool unsigned char

This is wrong.  The solution is simple:

  #define bool _Bool

on darwin.  Arguably, this is correct for every non-broken system as well.
Comment 6 Mike Stump 2010-12-16 22:48:05 UTC
http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01696.html

http://www.archivum.info/gcc-patches@gcc.gnu.org/2005-05/00877/Re-PATCH-to-libcpp-Move-to-the-intersection-of-C90-an-C++.html

Note, the last thread isn't on gcc's mail archive, it is in mine, and I know I wrote it, so I know that the gcc mail archives are bogus.

If their design is to believed, you must include all std headers, first, before all gcc headers, then include gcc headers, starting with the one that does the #define first before any use of bool.  I think that design is broken as designed.  We are merely witnessing the breakage.
Comment 7 Richard Biener 2011-01-03 20:59:41 UTC
(In reply to comment #5)
> On Dec 16, 2010, at 2:06 PM, iains at gcc dot gnu.org wrote:
> > gcc/system.h :
> 
> > # define bool unsigned char
> 
> This is wrong.  The solution is simple:
> 
>   #define bool _Bool
> 
> on darwin.  Arguably, this is correct for every non-broken system as well.

We can't rely on GCC or C99 support.  The correct fix is to define
bool to unsigned int for darwin then (and pay the space efficience loss
price).

Richard.
Comment 8 Iain Sandoe 2011-01-03 21:54:37 UTC
(In reply to comment #7)
> (In reply to comment #5)
> > On Dec 16, 2010, at 2:06 PM, iains at gcc dot gnu.org wrote:
> > > gcc/system.h :
> > 
> > > # define bool unsigned char
> > 
> > This is wrong.  The solution is simple:
> > 
> >   #define bool _Bool
> > 
> > on darwin.  Arguably, this is correct for every non-broken system as well.
> 
> We can't rely on GCC or C99 support.  The correct fix is to define
> bool to unsigned int for darwin then (and pay the space efficience loss
> price).

it is fixed by
http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01361.html
which either needs a global reviewer, or declaring to be obvious
 (Mike Stump reviewed at http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01425.html)
Comment 9 Iain Sandoe 2011-01-09 12:41:37 UTC
Author: iains
Date: Sun Jan  9 12:41:33 2011
New Revision: 168611

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168611
Log:

	PR gcc/46902
	PR testsuite/46912
	* plugin.c: Move include of dlfcn.h from here...
	* system.h: ... to here.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/plugin.c
    trunk/gcc/system.h
Comment 10 Dominique d'Humieres 2011-01-09 13:02:32 UTC
Closing as fixed, thanks for the patch.