[Bug c++/41020] [4.5 Regression] Can't declare an extern C friend of a builtin function

2009-10-30 Thread hjl at gcc dot gnu dot org


--- Comment #14 from hjl at gcc dot gnu dot org  2009-10-30 16:05 ---
Subject: Bug 41020

Author: hjl
Date: Fri Oct 30 16:04:41 2009
New Revision: 153759

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=153759
Log:
2009-10-30  H.J. Lu  hongjiu...@intel.com

Backport from mainline:
2009-10-30  Dodji Seketeli  do...@redhat.com

PR c++/41863
* g++.dg/template/sizeof12.C: New test.

2009-10-29  Martin Jambor  mjam...@suse.cz

PR tree-optimization/41775
* g++.dg/torture/pr41775.C: New testcase.

2009-10-28  Jakub Jelinek  ja...@redhat.com

PR debug/41801
* g++.dg/ext/sync-3.C: New test.

2009-10-27  Jakub Jelinek  ja...@redhat.com

PR c++/41020
* g++.dg/lookup/extern-c-redecl5.C: Fix up regexp.

2009-10-26  Jakub Jelinek  ja...@redhat.com

PR bootstrap/41345
* gcc.dg/pr41345.c: New test.

2009-10-26  Dodji Seketeli  do...@redhat.com

PR c++/41785
* g++.dg/cpp0x/variadic96.C: New test.

2009-10-26  Dodji Seketeli  do...@redhat.com

PR c++/41020
* g++.dg/lookup/extern-c-redecl2.C: New test.
* g++.dg/lookup/extern-c-redecl3.C: Likewise.
* g++.dg/lookup/extern-c-redecl4.C: Likewise.
* g++.dg/lookup/extern-c-redecl5.C: Likewise.

2009-10-23  Joseph Myers  jos...@codesourcery.com

PR c/40033
* gcc.dg/noncompile/pr40033-1.c: New test.

2009-10-23  Joseph Myers  jos...@codesourcery.com

PR c/41673
* gcc.dg/Wstrict-aliasing-bogus-vla-1.c: New test.

2009-10-21  Sebastian Pop  sebastian@amd.com

PR tree-optimization/41497
* gcc.dg/tree-ssa/pr41497.c: New.

Added:
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/variadic96.C
  - copied unchanged from r153757,
trunk/gcc/testsuite/g++.dg/cpp0x/variadic96.C
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/sync-3.C
  - copied unchanged from r153757, trunk/gcc/testsuite/g++.dg/ext/sync-3.C
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/lookup/extern-c-redecl2.C
  - copied unchanged from r153757,
trunk/gcc/testsuite/g++.dg/lookup/extern-c-redecl2.C
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C
  - copied unchanged from r153757,
trunk/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C
  - copied unchanged from r153757,
trunk/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/lookup/extern-c-redecl5.C
  - copied unchanged from r153757,
trunk/gcc/testsuite/g++.dg/lookup/extern-c-redecl5.C
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/sizeof12.C
  - copied unchanged from r153757,
trunk/gcc/testsuite/g++.dg/template/sizeof12.C
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr41775.C
  - copied unchanged from r153757,
trunk/gcc/testsuite/g++.dg/torture/pr41775.C
branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-vla-1.c
  - copied unchanged from r153758,
trunk/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-vla-1.c
branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/noncompile/pr40033-1.c
  - copied unchanged from r153758,
trunk/gcc/testsuite/gcc.dg/noncompile/pr40033-1.c
branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr41345.c
  - copied unchanged from r153757, trunk/gcc/testsuite/gcc.dg/pr41345.c
branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/tree-ssa/pr41497.c
  - copied unchanged from r153758,
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr41497.c
Modified:
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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



[Bug c++/41020] [4.5 Regression] Can't declare an extern C friend of a builtin function

2009-10-29 Thread law at gcc dot gnu dot org


--- Comment #13 from law at gcc dot gnu dot org  2009-10-29 16:50 ---
Subject: Bug 41020

Author: law
Date: Thu Oct 29 16:48:00 2009
New Revision: 153715

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=153715
Log:
Recorded merge of revisions
153580-153581,153584,153586-153600,153604,153606,153610,153613,153615-153618,153621,153643,153646-153648,153650-153652,153654-153667,153669-153671
via svnmerge from 
svn+ssh://l...@gcc.gnu.org/svn/gcc/trunk


  r153580 | gccadmin | 2009-10-26 18:17:26 -0600 (Mon, 26 Oct 2009) | 1 line

  Daily bump.

  r153581 | paolo | 2009-10-26 19:18:10 -0600 (Mon, 26 Oct 2009) | 6 lines

  2009-10-26  Paolo Carlini  paolo.carl...@oracle.com

* include/std/chrono (duration::duration(const duration)): Fix
per the straightforward resolution of DR 974.
* testsuite/20_util/duration/cons/dr974.cc: Add.

  r153584 | carrot | 2009-10-27 03:06:36 -0600 (Tue, 27 Oct 2009) | 16 lines

* target.h (have_conditional_execution): Add a new target hook
function.
* target-def.h (TARGET_HAVE_CONDITIONAL_EXECUTION): Likewise.
* targhooks.h (default_have_conditional_execution): Likewise.
* targhooks.c (default_have_conditional_execution): Likewise.
* doc/tm.texi (TARGET_HAVE_CONDITIONAL_EXECUTION): Document it.
* config/arm/arm.c (TARGET_HAVE_CONDITIONAL_EXECUTION): Define it.
(arm_have_conditional_execution): New function.
* ifcvt.c (noce_process_if_block, find_if_header,
cond_exec_find_if_block, dead_or_predicable): Change the usage of macro
HAVE_conditional_execution to a target hook call.
* recog.c (peephole2_optimize): Likewise.
* sched-rgn.c (add_branch_dependences): Likewise.
* final.c (asm_insn_count, final_scan_insn): Likewise.
* bb-reorder.c (HAVE_conditional_execution): Remove it.

  r153586 | ebotcazou | 2009-10-27 04:09:04 -0600 (Tue, 27 Oct 2009) | 1 line

  Fix nits

  r153587 | jakub | 2009-10-27 04:28:48 -0600 (Tue, 27 Oct 2009) | 3 lines

PR c++/41020
* g++.dg/lookup/extern-c-redecl5.C: Fix up regexp.

  r153588 | aldyh | 2009-10-27 05:18:12 -0600 (Tue, 27 Oct 2009) | 5 lines

PR bootstrap/41451
* fold-const.c (fold_binary_loc): Do not call
protected_set_expr_location.

  r153589 | rguenth | 2009-10-27 05:30:59 -0600 (Tue, 27 Oct 2009) | 5 lines

  2009-10-27  Richard Guenther  rguent...@suse.de

PR lto/41821
* gimple.c (gimple_types_compatible_p): Handle OFFSET_TYPE.

  r153590 | revitale | 2009-10-27 05:46:07 -0600 (Tue, 27 Oct 2009) | 1 line

  Fix PR40648 -- Fix misaligned store vectorizer patch

  r153591 | charlet | 2009-10-27 07:06:06 -0600 (Tue, 27 Oct 2009) | 16 lines

  2009-10-27  Arnaud Charlet  char...@adacore.com

* exp_aggr.adb: Fix comment.

  2009-10-27  Emmanuel Briot  br...@adacore.com

* prj-err.adb (Error_Msg): take into account continuation lines when
computing whether we have a warning.

  2009-10-27  Vasiliy Fofanov  fofa...@adacore.com

* make.adb, s-os_lib.adb, s-os_lib.ads (Create_Temp_Output_File): New
routine that is designed to create temp file descriptor specifically
for redirecting an output stream.

  r153592 | charlet | 2009-10-27 07:16:48 -0600 (Tue, 27 Oct 2009) | 45 lines

  2009-10-27  Vincent Celier  cel...@adacore.com

* makeutl.adb (Check_Source_Info_In_ALI): Do not recompile if a subunit
from the runtime is found, except if gnatmake switch -a is used and
this
subunit cannot be found.

  2009-10-27  Ed Schonberg  schonb...@adacore.com

* gnatbind.adb (gnatbind): When the -R option is selected, list
subunits
as well, for tools that need the complete closure of the main program.

  2009-10-27  Sergey Rybin  ry...@adacore.com

* gnat_ugn.texi: Minor updates.

  2009-10-27  Emmanuel Briot  br...@adacore.com

* prj-tree.adb (Free): Fix memory leak.

  2009-10-27  Vasiliy Fofanov  fofa...@adacore.com

* adaint.c, s-os_lib.adb (__gnat_create_output_file_new): New function
that ensures the file that is created is new. Use this function to make
sure there is no race condition if several processes are creating temp
files concurrently.

* s-os_lib.ads: Update comment.

  2009-10-27  Thomas Quinot  qui...@adacore.com

* sem_ch12.adb: Minor reformatting

  2009-10-27  Javier Miranda  mira...@adacore.com

* exp_ch4.ads (Integer_Promotion_Possible): New subprogram.
* exp_ch4.adb (Integer_Promotion_Possible): New subprogram.
(Expand_N_Type_Conversion): Replace code that checks if the integer
promotion of the operands is possible by a call to the new function
Integer_Promotion_Possible. Minor reformating because an enclosing
block is now not needed.
* checks.adb 

[Bug c++/41020] [4.5 Regression] Can't declare an extern C friend of a builtin function

2009-10-27 Thread jakub at gcc dot gnu dot org


--- Comment #12 from jakub at gcc dot gnu dot org  2009-10-27 10:29 ---
Subject: Bug 41020

Author: jakub
Date: Tue Oct 27 10:28:48 2009
New Revision: 153587

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=153587
Log:
PR c++/41020
* g++.dg/lookup/extern-c-redecl5.C: Fix up regexp.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/lookup/extern-c-redecl5.C


-- 


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



[Bug c++/41020] [4.5 Regression] Can't declare an extern C friend of a builtin function

2009-10-26 Thread dodji at gcc dot gnu dot org


--- Comment #10 from dodji at gcc dot gnu dot org  2009-10-26 14:40 ---
Subject: Bug 41020

Author: dodji
Date: Mon Oct 26 14:40:16 2009
New Revision: 153552

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=153552
Log:
Fix PR c++/41020

gcc/cp/ChangeLog:

PR c++/41020
* decl.c (decls_match): Use DECL_IS_BUILTIN instead of
DECL_BUILT_IN.

gcc/testsuite/ChangeLog:
PR c++/41020
* g++.dg/lookup/extern-c-redecl2.C: New test.
* g++.dg/lookup/extern-c-redecl3.C: Likewise.
* g++.dg/lookup/extern-c-redecl4.C: Likewise.
* g++.dg/lookup/extern-c-redecl5.C: Likewise.

Added:
trunk/gcc/testsuite/g++.dg/lookup/extern-c-redecl2.C
trunk/gcc/testsuite/g++.dg/lookup/extern-c-redecl3.C
trunk/gcc/testsuite/g++.dg/lookup/extern-c-redecl4.C
trunk/gcc/testsuite/g++.dg/lookup/extern-c-redecl5.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug c++/41020] [4.5 Regression] Can't declare an extern C friend of a builtin function

2009-10-26 Thread dodji at gcc dot gnu dot org


--- Comment #11 from dodji at gcc dot gnu dot org  2009-10-26 16:06 ---
Fixed in 4.5.0


-- 

dodji at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



Re: [Bug c++/41020] [4.5 Regression] Can't declare an extern C friend of a builtin function

2009-10-23 Thread Dodji Seketeli
Indeed. I am testing the patch below.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 5eb389f..7c01ee2 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -104,6 +104,7 @@ static void store_parm_decls (tree);
 static void initialize_local_var (tree, tree);
 static void expand_static_init (tree, tree);
 static tree next_initializable_field (tree);
+static int decls_match_1 (tree, tree, bool);
 
 /* The following symbols are subsumed in the cp_global_trees array, and
listed here individually for documentation purposes.
@@ -899,6 +900,14 @@ push_local_name (tree decl)
 int
 decls_match (tree newdecl, tree olddecl)
 {
+  return decls_match_1 (newdecl, olddecl, /* newdecl_is_friend  */ false);
+}
+
+/* Subroutine of decls_match.  */
+
+static int
+decls_match_1 (tree newdecl, tree olddecl, bool newdecl_is_friend)
+{
   int types_match;
 
   if (newdecl == olddecl)
@@ -934,9 +943,11 @@ decls_match (tree newdecl, tree olddecl)
 
 #ifdef NO_IMPLICIT_EXTERN_C
   /* A new declaration doesn't match a built-in one unless it
-is also extern C.  */
+is also extern C. Friend function re-declarations retain the
+the linkage of the original declaration though.  */
   if (DECL_BUILT_IN (olddecl)
-  DECL_EXTERN_C_P (olddecl)  !DECL_EXTERN_C_P (newdecl))
+  DECL_EXTERN_C_P (olddecl)  !DECL_EXTERN_C_P (newdecl)
+  !newdecl_is_friend)
return 0;
 #endif
 
@@ -1122,7 +1133,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool 
newdecl_is_friend)
   if (newdecl == olddecl)
 return olddecl;
 
-  types_match = decls_match (newdecl, olddecl);
+  types_match = decls_match_1 (newdecl, olddecl, newdecl_is_friend);
 
   /* If either the type of the new decl or the type of the old decl is an
  error_mark_node, then that implies that we have already issued an



[Bug c++/41020] [4.5 Regression] Can't declare an extern C friend of a builtin function

2009-10-23 Thread dodji at redhat dot com


--- Comment #8 from dodji at gcc dot gnu dot org  2009-10-23 18:19 ---
Subject: Re:  [4.5 Regression] Can't declare an extern C
friend of a builtin function

Indeed. I am testing the patch below.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 5eb389f..7c01ee2 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -104,6 +104,7 @@ static void store_parm_decls (tree);
 static void initialize_local_var (tree, tree);
 static void expand_static_init (tree, tree);
 static tree next_initializable_field (tree);
+static int decls_match_1 (tree, tree, bool);

 /* The following symbols are subsumed in the cp_global_trees array, and
listed here individually for documentation purposes.
@@ -899,6 +900,14 @@ push_local_name (tree decl)
 int
 decls_match (tree newdecl, tree olddecl)
 {
+  return decls_match_1 (newdecl, olddecl, /* newdecl_is_friend  */ false);
+}
+
+/* Subroutine of decls_match.  */
+
+static int
+decls_match_1 (tree newdecl, tree olddecl, bool newdecl_is_friend)
+{
   int types_match;

   if (newdecl == olddecl)
@@ -934,9 +943,11 @@ decls_match (tree newdecl, tree olddecl)

 #ifdef NO_IMPLICIT_EXTERN_C
   /* A new declaration doesn't match a built-in one unless it
-is also extern C.  */
+is also extern C. Friend function re-declarations retain the
+the linkage of the original declaration though.  */
   if (DECL_BUILT_IN (olddecl)
-  DECL_EXTERN_C_P (olddecl)  !DECL_EXTERN_C_P (newdecl))
+  DECL_EXTERN_C_P (olddecl)  !DECL_EXTERN_C_P (newdecl)
+  !newdecl_is_friend)
return 0;
 #endif

@@ -1122,7 +1133,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool
newdecl_is_friend)
   if (newdecl == olddecl)
 return olddecl;

-  types_match = decls_match (newdecl, olddecl);
+  types_match = decls_match_1 (newdecl, olddecl, newdecl_is_friend);

   /* If either the type of the new decl or the type of the old decl is an
  error_mark_node, then that implies that we have already issued an


-- 


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



[Bug c++/41020] [4.5 Regression] Can't declare an extern C friend of a builtin function

2009-10-23 Thread dodji at gcc dot gnu dot org


-- 

dodji at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |dodji at gcc dot gnu dot org
   |dot org |
 Status|NEW |ASSIGNED
   Last reconfirmed|2009-09-18 03:56:23 |2009-10-23 18:34:28
   date||


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



[Bug c++/41020] [4.5 Regression] Can't declare an extern C friend of a builtin function

2009-10-23 Thread dodji at redhat dot com


--- Comment #9 from dodji at gcc dot gnu dot org  2009-10-23 19:32 ---
Subject: Re:   New: Can't declare an extern C friend.

Patch submitted to http://gcc.gnu.org/ml/gcc-patches/2009-10/msg01486.html


-- 


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



[Bug c++/41020] [4.5 Regression] Can't declare an extern C friend of a builtin function

2009-10-04 Thread pinskia at gcc dot gnu dot org


--- Comment #7 from pinskia at gcc dot gnu dot org  2009-10-04 19:13 ---
This is related to builtins too because either using -fno-builtin or using
fork1 allows this program to work.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

Summary|[4.5 Regression] Can't  |[4.5 Regression] Can't
   |declare an extern C   |declare an extern C friend
   |friend. |of a builtin function


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



[Bug c++/41020] [4.5 Regression] Can't declare an extern C friend.

2009-08-23 Thread mmitchel at gcc dot gnu dot org


-- 

mmitchel at gcc dot gnu dot org changed:

   What|Removed |Added

   Priority|P3  |P1


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



[Bug c++/41020] [4.5 Regression] Can't declare an extern C friend.

2009-08-10 Thread rguenth at gcc dot gnu dot org


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

   Keywords||rejects-valid
Summary|Can't declare an extern C |[4.5 Regression] Can't
   |friend. |declare an extern C
   ||friend.
   Target Milestone|--- |4.5.0


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



[Bug c++/41020] [4.5 Regression] Can't declare an extern C friend.

2009-08-10 Thread davek at gcc dot gnu dot org


--- Comment #3 from davek at gcc dot gnu dot org  2009-08-10 16:17 ---
(In reply to comment #2)
 Apart from the semi-colon after the extern C block the code is valid and 
 this
 is a recent regression on trunk.

I am fairly sure that a semi-colon after a block statement like that is
unnecessary, but not actually invalid.  It certainly makes no difference to the
testcase whether it is present or absent.


-- 


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



[Bug c++/41020] [4.5 Regression] Can't declare an extern C friend.

2009-08-10 Thread jwakely dot gcc at gmail dot com


--- Comment #4 from jwakely dot gcc at gmail dot com  2009-08-10 17:05 
---
It's irrelevant to this bug and is just me being more pedantic than -pedantic,
however ... even with -pedantic GCC has always accepted stray semi-colons at
namespace scope, but it's not valid.

At function scope a lone ';' is a valid expression-statement, but
expression-statements are not allowed at namespace scope, only declarations
are, and ';' is not a valid declaration.


-- 


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



[Bug c++/41020] [4.5 Regression] Can't declare an extern C friend.

2009-08-10 Thread davek at gcc dot gnu dot org


--- Comment #5 from davek at gcc dot gnu dot org  2009-08-10 17:16 ---
(In reply to comment #4)
 It's irrelevant to this bug and is just me being more pedantic than -pedantic,
 however ... even with -pedantic GCC has always accepted stray semi-colons at
 namespace scope, but it's not valid.
 
 At function scope a lone ';' is a valid expression-statement, but
 expression-statements are not allowed at namespace scope, only declarations
 are, and ';' is not a valid declaration.

  Well you learn something new every day!  Never realised that was a gnu
extension, but it sure is, comeau online choked on my testcase:

ComeauTest.c, line 5: error: extra ; ignored,
In C: A function definition does not end with a semicolon
In C++: A non-member function definition, extern C block,
or namespace does not end with a semicolon
  };
   ^
  Anyway.  Consider the testcase amended.  :-)

$ cat friend.cxx

extern C
{
  int fork (void);
}

class frok
{
  int this_errno;
  friend int fork (void);
};

extern C int
fork (void)
{
  frok grouped;
  return grouped.this_errno;
}

$ g++-4 -c friend.cxx -o friend.o
friend.cxx:10:24: error: new declaration 'int fork()'
friend.cxx:4:7: error: ambiguates old declaration 'int fork()'
friend.cxx: In function 'int fork()':
friend.cxx:9:7: error: 'int frok::this_errno' is private
friend.cxx:17:18: error: within this context

$


-- 


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