Re: [patch] Fix debug info of nested inline functions

2012-05-19 Thread Eric Botcazou
  Does it really matter for concrete instances of inline functions?

 Nope.  Are those the only things with an abstract origin that will end
 up on limbo?

According to the head comment of the block, yes, but I can try and see what 
happens in real life.

 If we're always going to attach them to comp_unit_die () anyway, we might as
 well do that without the loop. 

We attach them to the first non-abstract parent function with the loop.  That's 
important for Ada because we rely on the static nesting of functions in the 
debug info to support up-level references in GDB (i.e. access to variables of 
parent functions from within nested functions).

-- 
Eric Botcazou


[Ada] Use C++-compatible calling convention on x86/Windows

2012-05-19 Thread Eric Botcazou
This changes the calling convention of primitive operations on x86/Windows (the 
equivalent of C++ methods) in order to be compatible with C++, which changed 
the calling convention in order to be compatible with MSVC++.

Tested on i686-pc-mingw32, applied on the mainline and 4.7 branch.


2012-05-19  Eric Botcazou  ebotca...@adacore.com

* gcc-interface/decl.c (Has_Thiscall_Convention): New macro.
(gnat_to_gnu_entity) E_Subprogram_Type: Test it to set the thiscall
calling convention
(get_minimal_subprog_decl): Likewise.
(gnat_first_param_is_class): New predicate.


-- 
Eric Botcazou
Index: gcc-interface/decl.c
===
--- gcc-interface/decl.c	(revision 187675)
+++ gcc-interface/decl.c	(working copy)
@@ -50,19 +50,23 @@
 #include ada-tree.h
 #include gigi.h
 
-/* Convention_Stdcall should be processed in a specific way on 32 bits
-   Windows targets only.  The macro below is a helper to avoid having to
-   check for a Windows specific attribute throughout this unit.  */
+/* stdcall and thiscall conventions should be processed in a specific way
+   on 32-bit x86/Windows only.  The macros below are helpers to avoid having
+   to check for a Windows specific attribute throughout this unit.  */
 
 #if TARGET_DLLIMPORT_DECL_ATTRIBUTES
 #ifdef TARGET_64BIT
 #define Has_Stdcall_Convention(E) \
   (!TARGET_64BIT  Convention (E) == Convention_Stdcall)
+#define Has_Thiscall_Convention(E) \
+  (!TARGET_64BIT  gnat_first_param_is_class (E))
 #else
 #define Has_Stdcall_Convention(E) (Convention (E) == Convention_Stdcall)
+#define Has_Thiscall_Convention(E) (gnat_first_param_is_class (E))
 #endif
 #else
 #define Has_Stdcall_Convention(E) 0
+#define Has_Thiscall_Convention(E) 0
 #endif
 
 /* Stack realignment is necessary for functions with foreign conventions when
@@ -126,6 +130,7 @@ DEF_VEC_ALLOC_O(variant_desc,heap);
 static GTY ((if_marked (tree_int_map_marked_p),
 	 param_is (struct tree_int_map))) htab_t annotate_value_cache;
 
+static bool gnat_first_param_is_class (Entity_Id) ATTRIBUTE_UNUSED;
 static bool allocatable_size_p (tree, bool);
 static void prepend_one_attribute_to (struct attrib **,
   enum attr_type, tree, tree, Node_Id);
@@ -4403,6 +4408,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
 	(attr_list, ATTR_MACHINE_ATTRIBUTE,
 	 get_identifier (stdcall), NULL_TREE,
 	 gnat_entity);
+	else if (Has_Thiscall_Convention (gnat_entity))
+	  prepend_one_attribute_to
+	(attr_list, ATTR_MACHINE_ATTRIBUTE,
+	 get_identifier (thiscall), NULL_TREE,
+	 gnat_entity);
 
 	/* If we should request stack realignment for a foreign convention
 	   subprogram, do so.  Note that this applies to task entry points in
@@ -5266,6 +5276,10 @@ get_minimal_subprog_decl (Entity_Id gnat
 prepend_one_attribute_to (attr_list, ATTR_MACHINE_ATTRIBUTE,
 			  get_identifier (stdcall), NULL_TREE,
 			  gnat_entity);
+  else if (Has_Thiscall_Convention (gnat_entity))
+prepend_one_attribute_to (attr_list, ATTR_MACHINE_ATTRIBUTE,
+			  get_identifier (thiscall), NULL_TREE,
+			  gnat_entity);
 
   if (No (Interface_Name (gnat_entity))  gnu_ext_name == gnu_entity_name)
 gnu_ext_name = NULL_TREE;
@@ -5275,6 +5289,63 @@ get_minimal_subprog_decl (Entity_Id gnat
 			 false, true, true, true, attr_list, gnat_entity);
 }
 
+/* Return whether the E_Subprogram_Type/E_Function/E_Procedure GNAT_ENTITY has
+   a first parameter with a class or equivalent type.
+
+   We use the predicate on 32-bit x86/Windows to find out whether we need to
+   use the thiscall calling convention for GNAT_ENTITY.  This convention is
+   the one set for C++ methods (functions with METHOD_TYPE) by the back-end.
+   Now in Ada primitive operations are regular subprograms (e.g. you can have
+   common pointers to both) so we cannot compute an equivalent of METHOD_TYPE
+   and so we set the calling convention in an uniform way.  */
+
+static bool
+gnat_first_param_is_class (Entity_Id gnat_entity)
+{
+  Entity_Id gnat_param = First_Formal_With_Extras (gnat_entity);
+  Entity_Id gnat_type;
+  Node_Id node;
+
+  if (No (gnat_param))
+return false;
+
+  gnat_type = Underlying_Type (Etype (gnat_param));
+
+  /* This is the main case.  Note that we must return the same value for
+ regular tagged types and CW types since dispatching calls have a CW
+ type on the caller side and a tagged type on the callee side.  */
+  if (Is_Tagged_Type (gnat_type))
+return True;
+
+  /* C++ classes with no virtual functions can be imported as limited
+ record types, but we need to return true for the constructors.  */
+  if (Is_CPP_Class (gnat_type))
+return True;
+
+  /* The language-level protected calling convention doesn't distinguish
+ tagged protected types from non-tagged protected types (e.g. you can
+ have common pointers to both) so we must use a single low-level calling
+ convention for it.  

[cxx-conversion] Fix builds with --enable-checking=release

2012-05-19 Thread Diego Novillo
This fixes a bug exposed by --enable-checking=release.

The patch to templatize the tree_check* routines had moved
tree_operand_length into an #ifdef ENABLE_CHECKING block.  This
breaks builds with checking disabled.

Tested on x86_64.  Committed.

2012-05-19   Diego Novillo  dnovi...@google.com

* tree.h (tree_operand_length): Move out of #ifdef ENABLE_CHECKING.

Index: gcc/tree.h
===
--- gcc/tree.h  (revision 187678)
+++ gcc/tree.h  (working copy)
@@ -3831,18 +3831,6 @@
   return __t-omp_clause.ops[__i];
 }
 
-/* Compute the number of operands in an expression node NODE.  For
-   tcc_vl_exp nodes like CALL_EXPRs, this is stored in the node itself,
-   otherwise it is looked up from the node's code.  */
-static inline int
-tree_operand_length (const_tree node)
-{
-  if (VL_EXP_CLASS_P (node))
-return VL_EXP_OPERAND_LENGTH (node);
-  else
-return TREE_CODE_LENGTH (TREE_CODE (node));
-}
-
 /* Special checks for TREE_OPERANDs.  */
 template typename Tree
 inline tree *
@@ -6045,6 +6033,18 @@
 
 void init_inline_once (void);
 
+/* Compute the number of operands in an expression node NODE.  For
+   tcc_vl_exp nodes like CALL_EXPRs, this is stored in the node itself,
+   otherwise it is looked up from the node's code.  */
+static inline int
+tree_operand_length (const_tree node)
+{
+  if (VL_EXP_CLASS_P (node))
+return VL_EXP_OPERAND_LENGTH (node);
+  else
+return TREE_CODE_LENGTH (TREE_CODE (node));
+}
+
 /* Abstract iterators for CALL_EXPRs.  These static inline definitions
have to go towards the end of tree.h so that union tree_node is fully
defined by this point.  */


Re: [Dwarf Patch] Improve pubnames and pubtypes generation. (issue 6197069)

2012-05-19 Thread Jason Merrill

On 05/18/2012 07:34 PM, saugust...@google.com wrote:

The motivation and new dwarf attributes and tags all stem from the debug
fission project as described at http://gcc.gnu.org/wiki/DebugFission.


Right.  Not sure why I missed the pubtypes bits on that page before...


The code I removed doesn't deal with omitting individual entries.
Instead, it decides whether to emit the pubtypes section at all


Ah, yes, I see.


What are these attributes for? Is there a proposal to add them?


The entire motivation for this patch, including the proposed new
attributes is at:

http://gcc.gnu.org/wiki/DebugFission

In particular, the section titled, Building a GDB Index.


OK, I've read that section and I still don't understand why the consumer 
would need a pointer from the CU to the pubnames section to build an 
index.  If we're looking for something by name, we go from pubnames to 
the CU.  If we're looking at the CU because we're in a function body, 
presumably we need to parse most of it anyway; is there really a 
significant benefit to having a separate what names does this CU 
define attribute?  The index is all name-die lookup, isn't it?


I'm also puzzled by what the proposal says about .debug_types.  Why 
would a pubtypes entry point to a CU that doesn't actually have a 
definition of the type?  Is it so that the consumer knows which .dwo to 
look in?  Perhaps we could do something else with the sig8 instead of 
pointing to the wrong unit.



The DWARF standard says that pubnames is for names with global scope; this
change would add namespace-scope statics as well.


I am matching what gold and gdb do when building the gdb index.


Ah.  If that's what GDB wants I guess it makes sense, but I'd like to 
see reaction from the committee to this particular aspect.  I haven't 
noticed it come up in the committee discussion of Fission.



Why do we need pubtype entries for base types?


Same as above--to make these addable to the index, which in turn makes
gdb faster. I'll add this to the note to Cary.


Really?  GDB wants to look up built-in types in the index rather than 
just knowing what int means?



Why bypass the DECL_NAMELESS check?


So objects within anonymous namespaces get pubnames:

namespace { void some_function...


Hmm, it would give the anonymous namespace itself a pubname, but I don't 
see how it would make any difference to objects within the namespace.


Jason


Re: [patch] Fix debug info of nested inline functions

2012-05-19 Thread Jason Merrill

On 05/19/2012 04:40 AM, Eric Botcazou wrote:

We attach them to the first non-abstract parent function with the loop.  That's
important for Ada because we rely on the static nesting of functions in the
debug info to support up-level references in GDB (i.e. access to variables of
parent functions from within nested functions).


Aha.  The patch is OK.

Jason



Symbol table 22/many: handle all aliases through the symtab

2012-05-19 Thread Jan Hubicka
Hi,
so far we handled only aliases that looked sane by the new cgraph/varpool code. 
 This 
patch should complette the transition and we now handle all aliases this way.
It also adds an error into case we decided to not handle - the 
function-variable
aliases.

Bootstrapped/regtested x86_64-linux, comitted.
I will followup with cleanups and removal of the new unreachable old alias 
handling code.
Honza

* cgraphunit.c (handle_alias_pairs): Cleanup; handle all types of 
aliases.
Index: cgraphunit.c
===
*** cgraphunit.c(revision 187678)
--- cgraphunit.c(working copy)
*** handle_alias_pairs (void)
*** 1030,1081 
  {
alias_pair *p;
unsigned i;
-   struct cgraph_node *target_node;
-   struct cgraph_node *src_node;
-   struct varpool_node *target_vnode;

for (i = 0; VEC_iterate (alias_pair, alias_pairs, i, p);)
  {
!   if (TREE_CODE (p-decl) == FUNCTION_DECL
!  (target_node = cgraph_node_for_asm (p-target)) != NULL)
!   {
! src_node = cgraph_get_node (p-decl);
! if (src_node  src_node-local.finalized)
! cgraph_reset_node (src_node);
! /* Normally EXTERNAL flag is used to mark external inlines,
!however for aliases it seems to be allowed to use it w/o
!any meaning. See gcc.dg/attr-alias-3.c  
!However for weakref we insist on EXTERNAL flag being set.
!See gcc.dg/attr-alias-5.c  */
! if (DECL_EXTERNAL (p-decl))
!   DECL_EXTERNAL (p-decl)
! = lookup_attribute (weakref,
! DECL_ATTRIBUTES (p-decl)) != NULL;
! cgraph_create_function_alias (p-decl, target_node-symbol.decl);
! VEC_unordered_remove (alias_pair, alias_pairs, i);
!   }
!   else if (TREE_CODE (p-decl) == VAR_DECL
!   (target_vnode = varpool_node_for_asm (p-target)) != NULL)
!   {
! /* Normally EXTERNAL flag is used to mark external inlines,
!however for aliases it seems to be allowed to use it w/o
!any meaning. See gcc.dg/attr-alias-3.c  
!However for weakref we insist on EXTERNAL flag being set.
!See gcc.dg/attr-alias-5.c  */
! if (DECL_EXTERNAL (p-decl))
!   DECL_EXTERNAL (p-decl)
! = lookup_attribute (weakref,
! DECL_ATTRIBUTES (p-decl)) != NULL;
! varpool_create_variable_alias (p-decl, target_vnode-symbol.decl);
! VEC_unordered_remove (alias_pair, alias_pairs, i);
!   }
/* Weakrefs with target not defined in current unit are easy to handle; 
they
 behave just as external variables except we need to note the alias flag
 to later output the weakref pseudo op into asm file.  */
!   else if (lookup_attribute (weakref, DECL_ATTRIBUTES (p-decl)) != NULL
!   (TREE_CODE (p-decl) == FUNCTION_DECL
!  ? (varpool_node_for_asm (p-target) == NULL)
!  : (cgraph_node_for_asm (p-target) == NULL)))
{
  if (TREE_CODE (p-decl) == FUNCTION_DECL)
cgraph_get_create_node (p-decl)-alias = true;
--- 1030,1044 
  {
alias_pair *p;
unsigned i;

for (i = 0; VEC_iterate (alias_pair, alias_pairs, i, p);)
  {
!   symtab_node target_node = symtab_node_for_asm (p-target);
! 
/* Weakrefs with target not defined in current unit are easy to handle; 
they
 behave just as external variables except we need to note the alias flag
 to later output the weakref pseudo op into asm file.  */
!   if (!target_node  lookup_attribute (weakref, DECL_ATTRIBUTES 
(p-decl)) != NULL)
{
  if (TREE_CODE (p-decl) == FUNCTION_DECL)
cgraph_get_create_node (p-decl)-alias = true;
*** handle_alias_pairs (void)
*** 1083,1097 
varpool_get_node (p-decl)-alias = true;
  DECL_EXTERNAL (p-decl) = 1;
  VEC_unordered_remove (alias_pair, alias_pairs, i);
}
!   else
{
! if (dump_file)
!   fprintf (dump_file, Unhandled alias %s-%s\n,
!IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (p-decl)),
!IDENTIFIER_POINTER (p-target));
  
! i++;
}
  }
  }
--- 1046,1092 
varpool_get_node (p-decl)-alias = true;
  DECL_EXTERNAL (p-decl) = 1;
  VEC_unordered_remove (alias_pair, alias_pairs, i);
+ continue;
}
!   else if (!target_node)
{
! error (%q+D aliased to undefined symbol %qE, p-decl, p-target);
! VEC_unordered_remove (alias_pair, alias_pairs, i);
! continue;
!   }
  
!   /* Normally EXTERNAL flag is used to mark external inlines,
!however for aliases it seems to be allowed to use it w/o
!any meaning. See gcc.dg/attr-alias-3.c  
!However for weakref we insist 

Re: [patch] support for multiarch systems

2012-05-19 Thread Thomas Schwinge
Hi!

On Wed, 09 May 2012 02:38:11 +0200, Matthias Klose d...@ubuntu.com wrote:
 ok, the attached patch includes just the support for the x86 targets, 
 including
 the kfreebsd and the hurd systems. The x32 multiarch tuple isn't yet defined, 
 so
 I'd like to keep it out of the first version.

I will test this on/for GNU/Hurd next week (hopefully), but here are
already two comments.

 Index: gcc/Makefile.in
 ===
 --- gcc/Makefile.in   (revision 187271)
 +++ gcc/Makefile.in   (working copy)
 @@ -350,6 +350,17 @@
  
  enable_plugin = @enable_plugin@
  
 +# Multiarch support
 +enable_multiarch = @enable_multiarch@
 +with_float = @with_float@
 +ifeq ($(enable_multiarch),yes)
 +  if_multiarch = $(1)
 +else ifeq ($(enable_multiarch),auto-detect)
 +  if_multiarch = $(if $(wildcard $(shell echo 
 $(SYSTEM_HEADER_DIR))/../../usr/lib/*/crti.o),$(1))
 +else
 +  if_multiarch =
 +endif

The auto-detection won't work for cases where native_system_header_dir
(as per config.gcc; or command-line argument) is not /usr/include.

 Index: gcc/config.gcc
 ===
 --- gcc/config.gcc(revision 187271)
 +++ gcc/config.gcc(working copy)
 @@ -3472,10 +3476,14 @@
  
   i[34567]86-*-darwin* | x86_64-*-darwin*)
   ;;
 - i[34567]86-*-linux* | x86_64-*-linux* | \
 -   i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \
 -   i[34567]86-*-gnu*)
 + i[34567]86-*-linux* | x86_64-*-linux*)
   ;;
 + i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu)
 + tmake_file=${tmake_file} i386/t-linux i386/t-kfreebsd
 + ;;
 + i[34567]86-*-gnu*)
 + tmake_file=${tmake_file} i386/t-linux i386/t-gnu
 + ;;

 Index: gcc/config/i386/t-linux
 ===
 --- gcc/config/i386/t-linux   (revision 0)
 +++ gcc/config/i386/t-linux   (revision 0)
 @@ -0,0 +1 @@
 +MULTIARCH_DIRNAME = $(call if_multiarch,i386-linux-gnu)
 Index: gcc/config/i386/t-gnu
 ===
 --- gcc/config/i386/t-gnu (revision 0)
 +++ gcc/config/i386/t-gnu (revision 0)
 @@ -0,0 +1 @@
 +MULTIARCH_DIRNAME = $(call if_multiarch,i386-gnu)

 Index: gcc/config/i386/t-kfreebsd
 ===
 --- gcc/config/i386/t-kfreebsd(revision 0)
 +++ gcc/config/i386/t-kfreebsd(revision 0)
 @@ -0,0 +1,5 @@
 +MULTIARCH_DIRNAME = $(call if_multiarch,i386-kfreebsd-gnu)
 +
 +# MULTILIB_OSDIRNAMES are set in t-linux64.
 +KFREEBSD_OS = $(filter kfreebsd%, $(word 3, $(subst -, ,$(target
 +MULTILIB_OSDIRNAMES := $(subst linux,$(KFREEBSD_OS),$(MULTILIB_OSDIRNAMES))

As of 2011-11-02 (a997b0d8a7b720578f40c0f9f7767bac02022e0b, r180767)
there was no i386/t-linux anymore, and you're now re-introducing it, so
you'll need to re-add it for the *-linux* cases cited above, but also
remove it from the other *-gnu* cases.


Grüße,
 Thomas


pgpvaJUXakrU4.pgp
Description: PGP signature


Symbol table 23/many: remove alias_pairs code from LTO streaming

2012-05-19 Thread Jan Hubicka
Hi,
this patch removes now dead code to stream alias pairs.
Bootstrapped/regtested x86_64-linux, comitted.

honza 
Index: ChangeLog
===
*** ChangeLog   (revision 187680)
--- ChangeLog   (working copy)
***
*** 1,5 
--- 1,19 
  2012-05-18  Jan Hubicka  j...@suse.cz
  
+   * cgraphunit.c (handle_alias_pairs): Declare; free alias_pairs
+   (cgraph_process_new_functions): Process also aliases.
+   * lto-streamer-out.c (struct sets): Remove.
+   (trivally_defined_alias): Remove.
+   (output_alias_pair_p): Remove.
+   (output_unreferenced_globals): Remove.
+   (produce_symtab); Do not handle alias pairs.
+   (produce_asm_for_decls): Likewise.
+   * lto-streamer-in.c (input_alias_pairs): Remove.
+   (lto_read_body): Do not input alias pairs.
+   (lto_input_constructors_and_inits): Remove.
+ 
+ 2012-05-18  Jan Hubicka  j...@suse.cz
+ 
* cgraphunit.c (handle_alias_pairs): Cleanup; handle all types of 
aliases.
  
  2012-05-18  Jan Hubicka  j...@suse.cz
Index: lto/ChangeLog
===
*** lto/ChangeLog   (revision 187679)
--- lto/ChangeLog   (working copy)
***
*** 1,3 
--- 1,8 
+ 2012-05-18  Jan Hubicka  j...@suse.cz
+ 
+   * lto.c (lto_materialize_constructors_and_inits): Remove.
+   (read_cgraph_and_symbols): Remove handling of alias pairs.
+ 
  2012-05-17  Jan Hubicka  j...@suse.cz
  
* lto-partition.c (add_references_to_partition): Handle external vars.
Index: cgraphunit.c
===
*** cgraphunit.c(revision 187680)
--- cgraphunit.c(working copy)
*** static void expand_all_functions (void);
*** 205,210 
--- 205,211 
  static void mark_functions_to_output (void);
  static void expand_function (struct cgraph_node *);
  static void cgraph_analyze_function (struct cgraph_node *);
+ static void handle_alias_pairs (void);
  
  FILE *cgraph_dump_file;
  
*** cgraph_process_new_functions (void)
*** 284,289 
--- 285,292 
  
if (!cgraph_new_nodes)
  return false;
+   finish_aliases_1 ();
+   handle_alias_pairs ();
/*  Note that this queue may grow as its being processed, as the new
functions may generate new ones.  */
for (csi = csi_start (cgraph_new_nodes); !csi_end_p (csi); csi_next (csi))
*** handle_alias_pairs (void)
*** 1089,1094 
--- 1092,1098 
  VEC_unordered_remove (alias_pair, alias_pairs, i);
}
  }
+   VEC_free (alias_pair, gc, alias_pairs);
  }
  
  
Index: lto-streamer-out.c
===
*** lto-streamer-out.c  (revision 187679)
--- lto-streamer-out.c  (working copy)
*** output_function (struct cgraph_node *nod
*** 852,966 
  }
  
  
- /* Used to pass data to trivally_defined_alias callback.  */
- struct sets {
-   cgraph_node_set set;
-   varpool_node_set vset;
- };
- 
- 
- /* Return true if alias pair P belongs to the set of cgraph nodes in
-SET.  If P is a an alias for a VAR_DECL, it can always be emitted.
-However, for FUNCTION_DECL aliases, we should only output the pair
-if it belongs to a function whose cgraph node is in SET.
-Otherwise, the LTRANS phase will get into trouble when finalizing
-aliases because the alias will refer to a function not defined in
-the file processed by LTRANS.  */
- 
- static bool
- trivally_defined_alias (tree decl ATTRIBUTE_UNUSED,
-   tree target, void *data)
- {
-   struct sets *set = (struct sets *) data;
-   struct cgraph_node *fnode = NULL;
-   struct varpool_node *vnode = NULL;
- 
-   fnode = cgraph_node_for_asm (target);
-   if (fnode)
- return cgraph_node_in_set_p (fnode, set-set);
-   vnode = varpool_node_for_asm (target);
-   return vnode  varpool_node_in_set_p (vnode, set-vset);
- }
- 
- /* Return true if alias pair P should be output in the current
-partition contains cgrpah nodes SET and varpool nodes VSET.
-DEFINED is set of all aliases whose targets are defined in
-the partition.
- 
-Normal aliases are output when they are defined, while WEAKREF
-aliases are output when they are used.  */
- 
- static bool
- output_alias_pair_p (alias_pair *p, symbol_alias_set_t *defined,
-cgraph_node_set set, varpool_node_set vset)
- {
-   struct cgraph_node *node;
-   struct varpool_node *vnode;
- 
-   if (lookup_attribute (weakref, DECL_ATTRIBUTES (p-decl)))
- {
-   if (TREE_CODE (p-decl) == VAR_DECL)
-   {
- vnode = varpool_get_node (p-decl);
- return (vnode
-  referenced_from_this_partition_p (vnode-symbol.ref_list,
- set, vset));
-   }
-   node = cgraph_get_node (p-decl);
-   return (node
- 

[PATCH, java] Fix placement of #ifdef JCR_SECTION_NAME in class.c

2012-05-19 Thread John David Anglin
The attached change fixes a compilation error that occurs because
JCR_SECTION_NAME is not defined on hppa*-hpux.

Tested on hppa2.0w-hp-hpux11.11.

Ok for trunk?

Dave
-- 
J. David Anglin  dave.ang...@nrc-cnrc.gc.ca
National Research Council of Canada  (613) 990-0752 (FAX: 952-6602)

2012-05-19  John David Anglin  dave.ang...@nrc-cnrc.gc.ca

PR java/52815
* class.c (emit_register_classes_in_jcr_section): Revise placement
of #ifdef JCR_SECTION_NAME.

Index: class.c
===
--- class.c (revision 186553)
+++ class.c (working copy)
@@ -2791,17 +2791,12 @@
 static void
 emit_register_classes_in_jcr_section (void)
 {
+#ifdef JCR_SECTION_NAME
   tree klass, cdecl, class_array_type;
   int i;
   int size = VEC_length (tree, registered_class);
   VEC(constructor_elt,gc) *init = VEC_alloc (constructor_elt, gc, size);
 
-#ifndef JCR_SECTION_NAME
-  /* A target has defined TARGET_USE_JCR_SECTION,
- but doesn't have a JCR_SECTION_NAME.  */
-  gcc_unreachable ();
-#endif
-
   FOR_EACH_VEC_ELT (tree, registered_class, i, klass)
 CONSTRUCTOR_APPEND_ELT (init, NULL_TREE, build_fold_addr_expr (klass));
 
@@ -2827,6 +2822,11 @@
   relayout_decl (cdecl);
   rest_of_decl_compilation (cdecl, 1, 0);
   mark_decl_referenced (cdecl);
+#else
+  /* A target has defined TARGET_USE_JCR_SECTION,
+ but doesn't have a JCR_SECTION_NAME.  */
+  gcc_unreachable ();
+#endif
 }
 
 


[PATCH, libatomic] Fix cut and paste errors in libat_test_and_set

2012-05-19 Thread John David Anglin
Tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11.

Ok for trunk?

-- 
J. David Anglin  dave.ang...@nrc-cnrc.gc.ca
National Research Council of Canada  (613) 990-0752 (FAX: 952-6602)

2012-05-19  John David Anglin  dave.ang...@nrc-cnrc.gc.ca

PR other/53231
* tas_n.c (libat_test_and_set): Correct return.  Remove unused variable.

Index: tas_n.c
===
--- tas_n.c (revision 187663)
+++ tas_n.c (working copy)
@@ -85,7 +85,7 @@
 bool
 SIZE(libat_test_and_set) (UTYPE *mptr, int smodel)
 {
-  UTYPE oldval, newval;
+  UTYPE oldval;
   UWORD magic;
 
   pre_seq_barrier (smodel);
@@ -97,7 +97,7 @@
   protect_end (mptr, magic);
   post_seq_barrier (smodel);
 
-  return ret != 0;
+  return oldval != 0;
 }
 
 #define DONE 1


Re: [PATCH] Remove TYPE_IS_SIZETYPE

2012-05-19 Thread Eric Botcazou
  We could go one step farther then and do the replacement in
 
           if (gimple_has_volatile_ops (stmt)
               || stmt_could_throw_p (stmt))
             continue;
 
  I think that's equivalent.  Revised patch attached.

 Indeed.

 Ok.

Thanks.  It turns out that the Ada compiler cannot be bootstrapped in LTO mode 
on the 4.7 branch without the tree-ssa-pre.c patch, which is a regression from 
4.6 so I've backported it after bootstrapping/regtesting on x86_64-suse-linux.

-- 
Eric Botcazou


[PATCH] Fix PR 53395: tree-if-conv.c not producing MAX_EXPR

2012-05-19 Thread Andrew Pinski
The problem here is that tree-if-conv.c produces COND_EXPR instead of
the MAX/MIN EXPRs.  When I added the expansion from COND_EXPR to
conditional moves, I assumes that the expressions which should have
been converted into MAX_EXPR/MIN_EXPR have already happened.

This fixes the problem by having tree-if-conv fold the expression so
the MIN_EXPR/MAX_EXPR appears in the IR rather than COND_EXPR and the
expansion happens correctly to the min/max rtl rather than just
through the conditional move ones.

OK?  Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Thanks,
Andrew Pinski

ChangeLog:
* tree-if-conv.c (predicate_scalar_phi): Call fold_build3 instead of build3.
(predicate_mem_writes): Likewise.
Index: tree-if-conv.c
===
--- tree-if-conv.c  (revision 187683)
+++ tree-if-conv.c  (working copy)
@@ -1313,8 +1313,8 @@ predicate_scalar_phi (gimple phi, tree c
   || bb_postdominates_preds (bb));
 
   /* Build new RHS using selected condition and arguments.  */
-  rhs = build3 (COND_EXPR, TREE_TYPE (res),
-   unshare_expr (cond), arg_0, arg_1);
+  rhs = fold_build3 (COND_EXPR, TREE_TYPE (res),
+unshare_expr (cond), arg_0, arg_1);
 }
 
   new_stmt = gimple_build_assign (res, rhs);
@@ -1574,7 +1574,7 @@ predicate_mem_writes (loop_p loop)
cond = force_gimple_operand_gsi_1 (gsi, unshare_expr (cond),
   is_gimple_condexpr, NULL_TREE,
   true, GSI_SAME_STMT);
-   rhs = build3 (COND_EXPR, type, unshare_expr (cond), rhs, lhs);
+   rhs = fold_build3 (COND_EXPR, type, unshare_expr (cond), rhs, lhs);
gimple_assign_set_rhs1 (stmt, ifc_temp_var (type, rhs, gsi));
update_stmt (stmt);
  }


RFA: update comment in dwarf2.def re: UPC extensions

2012-05-19 Thread Gary Funck

In the past, the UPC extensions to the DWARF2 debugging
information format were described in a proposal.  That
proposal was subsequently accepted and documented in the
DWARF4 specification.

Index: include/dwarf2.def
===
--- include/dwarf2.def  (revision 187674)
+++ include/dwarf2.def  (working copy)
@@ -167,7 +167,7 @@ DW_TAG (DW_TAG_GNU_formal_parameter_pack
are properly part of DWARF 5.  */
 DW_TAG (DW_TAG_GNU_call_site, 0x4109)
 DW_TAG (DW_TAG_GNU_call_site_parameter, 0x410a)
-/* Extensions for UPC.  See: http://upc.gwu.edu/~upc.  */
+/* Extensions for UPC.  See: http://dwarfstd.org/doc/DWARF4.pdf.  */
 DW_TAG (DW_TAG_upc_shared_type, 0x8765)
 DW_TAG (DW_TAG_upc_strict_type, 0x8766)
 DW_TAG (DW_TAG_upc_relaxed_type, 0x8767)

The change above updates the URL.  Alternatively, the URL
can be dropped completely?

thanks,
- Gary


Re: RFA: update comment in dwarf2.def re: UPC extensions

2012-05-19 Thread Jason Merrill

OK.

Jason


Re: RFA: update comment in dwarf2.def re: UPC extensions

2012-05-19 Thread Gary Funck
On 05/19/12 20:37:19, Jason Merrill wrote:
 OK.

Done. Thanks.