Re: libstdc++.exp patch

2011-04-26 Thread Rainer Orth
François Dumont  writes:

> Attached patch applied.
>
> 2011-04-21  François Dumont 
>
> * testsuite/lib/libstdc++.exp (check_v3_target_time): Discard
> unused compilation result thanks to /dev/null.
> * testsuite/lib/libstdc++.exp (check_v3_target_debug_mode
> check_v3_target_profile_mode check_v3_target_normal_mode
> check_v3_target_cstdint check_v3_target_cmath
> check_v3_target_atomic_builtins check_v3_target_gthreads
> check_v3_target_nanosleep check_v3_target_sched_yield
> check_v3_target_string_conversions check_v3_target_swprintf
> check_v3_target_binary_io): Use simple preprocessing rather than
> compilation. Discard unused preprocessing result thanks to
> /dev/null.

Please separate the proc names by commas in the ChangeLog.

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [doc] Adjust reference to ACATS in sourcebuild.texi

2011-04-26 Thread Rainer Orth
Gerald Pfeifer  writes:

> Installed on mainline; if someone wants me to, happy to apply to older
> branches as well.
>
> Gerald
>
> 2011-04-24  Gerald Pfeifer  
>
>   * doc/sourcebuild.texi (Ada Tests): Adjust reference to ACATS
>   testsuite and make it version agnostic.

I doubt this is a good idea: while you can find out what version of
ACATS is included in GCC, the information is somewhat hard to find
(gcc/testsuite/ada/acats/support/acats25.lst) and what update has been
used cannot be easily determined at all.  I'd keep the version
reference.  Arnaud?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[debug] PR42288 emit empty .debug_aranges section

2011-04-26 Thread Mark Wielaard
Hi,

This PR was put on hold for a while since gdb didn't immediately need
it. But the consensus seemed that it was a good idea to always output
the address ranges (.debug_arange section) information if a CU
(.debug_info section) was emitted. Because the consumer has no way to
tell the difference between an empty table that we omitted and failure
to generate a table that would have contained data. We recently
discussed this again (see PR), and it still seems like a good thing. So
here it a patch to just do that:

2011-04-26  Mark Wielaard  

PR42288
* dwarf2out.c (dwarf2out_finish): Always call output_aranges ()
when info_section_emitted.

Tested on i686-pc-linux-gnu, no changes in test results.

Cheers,

Mark
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index f3c4c09..520d7a2 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -23812,21 +23812,17 @@ dwarf2out_finish (const char *filename)
 	}
 }
 
-  /* Output the address range information.  We only put functions in the
- arange table, so don't write it out if we don't have any.  */
+  /* Output the address range information if a CU (.debug_info section)
+ was emitted.  We output an empty table even if we had no functions
+ to put in it.  This because the consumer has no way to tell the
+ difference between an empty table that we omitted and failure to
+ generate a table that would have contained data.  */
   if (info_section_emitted)
 {
   unsigned long aranges_length = size_of_aranges ();
 
-  /* Empty .debug_aranges would contain just header and
-	 terminating 0,0.  */
-  if (aranges_length
-	  != (unsigned long) (DWARF_ARANGES_HEADER_SIZE
-			  + 2 * DWARF2_ADDR_SIZE))
-	{
-	  switch_to_section (debug_aranges_section);
-	  output_aranges (aranges_length);
-	}
+  switch_to_section (debug_aranges_section);
+  output_aranges (aranges_length);
 }
 
   /* Output ranges section if necessary.  */


Re: [debug] PR42288 emit empty .debug_aranges section

2011-04-26 Thread Rainer Orth
Mark Wielaard  writes:

> This PR was put on hold for a while since gdb didn't immediately need
> it. But the consensus seemed that it was a good idea to always output
> the address ranges (.debug_arange section) information if a CU
> (.debug_info section) was emitted. Because the consumer has no way to
> tell the difference between an empty table that we omitted and failure
> to generate a table that would have contained data. We recently
> discussed this again (see PR), and it still seems like a good thing. So
> here it a patch to just do that:

I doubt this is a good idea in general: I've seen the following failure
in the libgo testsuite on IRIX 6.5:

_gotest_.o ERROR:  dwarf_elf_init:  DW_DLE_DEBUG_ABBREV_NULL 34 .debug_abbrev 
section present but elf_getdata() failed or section is zero-length
gotest: warning: no tests matching Test([^a-z].*)? in _gotest_.o _xtest_.o

elfdump reveals:

[13]   SHT_MIPS_DWARF0  0x410  0   .debug_abbrev
   0  0  0x10  0x 

So at least some linkers and tools get confused by such emtpy sections.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [debug] PR42288 emit empty .debug_aranges section

2011-04-26 Thread Mark Wielaard
Hi Rainer,

On Tue, 2011-04-26 at 11:22 +0200, Rainer Orth wrote:
> Mark Wielaard  writes:
> 
> > This PR was put on hold for a while since gdb didn't immediately need
> > it. But the consensus seemed that it was a good idea to always output
> > the address ranges (.debug_arange section) information if a CU
> > (.debug_info section) was emitted. Because the consumer has no way to
> > tell the difference between an empty table that we omitted and failure
> > to generate a table that would have contained data. We recently
> > discussed this again (see PR), and it still seems like a good thing. So
> > here it a patch to just do that:
> 
> I doubt this is a good idea in general: I've seen the following failure
> in the libgo testsuite on IRIX 6.5:
> 
> _gotest_.o ERROR:  dwarf_elf_init:  DW_DLE_DEBUG_ABBREV_NULL 34 .debug_abbrev 
> section present but elf_getdata() failed or section is zero-length
> gotest: warning: no tests matching Test([^a-z].*)? in _gotest_.o _xtest_.o
> 
> elfdump reveals:
> 
> [13]   SHT_MIPS_DWARF0  0x410  0   .debug_abbrev
>0  0  0x10  0x 
> 
> So at least some linkers and tools get confused by such emtpy sections.

Thanks for testing the patch. Although I am slightly confused how it
ended up producing a .debug_abbrev section that is actually empty. Are
you sure this isn't an existing issue?

The only thing the patch should do (and seems to do on my GNU/Linux
setup) is to explicitly output a .debug_aranges section that is of the
minimum size (so not actually empty, just indicating no ranges are
covered by outputting just the table terminator).

If you could provide me with some more information (I have neither an
IRIX 6.5, nor a libgo setup here) about the created files before/after
the patch that would be appreciated. I might have missed some other
interaction between the debug section output.

Thanks,

Mark



[PATCH][ARM] Fix -Werror build failure

2011-04-26 Thread Andrew Stubbs
My previous patch to clean up MOVW support left an unused variable. I 
tested building a cross-compiler, but not with -Werror. Others have 
reported native bootstrap failing. :(


This patch fixes that problem, and removes the unused variable warning 
message.


OK?

Andrew
2011-04-26  Andrew Stubbs  

	gcc/
	* config/arm/arm.c (arm_gen_constant): Remove can_negate_initial.

--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -2551,7 +2551,6 @@ arm_gen_constant (enum rtx_code code, enum machine_mode mode, rtx cond,
   int can_invert = 0;
   int can_negate = 0;
   int final_invert = 0;
-  int can_negate_initial = 0;
   int i;
   int num_bits_set = 0;
   int set_sign_bit_copies = 0;
@@ -2575,7 +2574,6 @@ arm_gen_constant (enum rtx_code code, enum machine_mode mode, rtx cond,
 
 case PLUS:
   can_negate = 1;
-  can_negate_initial = 1;
   break;
 
 case IOR:


[PATCH] Fix PR48753

2011-04-26 Thread Richard Guenther

Value-profiling now creates proper integer constants.

Installed.

Richard.

2011-04-26  Richard Guenther  

PR testsuite/48753
* gcc.dg/tree-prof/val-prof-2.c: Adjust.

Index: gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c
===
--- gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c (revision 172953)
+++ gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c (working copy)
@@ -26,7 +26,7 @@ main ()
 /* { dg-final-use { scan-ipa-dump "Mod power of 2 transformation on insn" 
"tree_profile_ipa" } } */
 /* This is part of code checking that n is power of 2, so we are sure that the 
transformation
didn't get optimized out.  */
-/* { dg-final-use { scan-tree-dump "n_\[0-9\]* \\+ 0x" "optimized"} } */
+/* { dg-final-use { scan-tree-dump "n_\[0-9\]* \\+ 4294967295" "optimized"} } 
*/
 /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
 /* { dg-final-use { cleanup-tree-dump "optimized" } } */
 /* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */


Re: [PATCH][ARM] Fix -Werror build failure

2011-04-26 Thread Ramana Radhakrishnan
>
> OK?

OK.

Ramana


[wwwdocs] PATCH for Re: going from SunOS 5/SparcWorks -> Linux/gcc

2011-04-26 Thread Gerald Pfeifer
Hi Paweł,

On Thu, 29 Apr 2010, Paweł Sikora wrote:
>> The standard 1st questions are:
>> 1) Did you compile with -Wall -Wextra and solve all warnings?
>> 2) Did you try with -fno-strict-aliasing?
> for legacy code, the '-fwrapv' could be helpful.

your mail reminded me that we could/should clarify this in our bug 
reporting instructions.

The patch below, which I just committed, does that.

Thanks for the hint!

Gerald


Index: bugs/index.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/bugs/index.html,v
retrieving revision 1.107
diff -u -r1.107 index.html
--- bugs/index.html 24 Apr 2011 09:51:55 -  1.107
+++ bugs/index.html 25 Apr 2011 20:58:56 -
@@ -51,10 +51,11 @@
 list of well-known bugs and, if possible,
 try a current release or development snapshot.
 
-Before reporting that GCC compiles your code incorrectly, please
-compile it with gcc -Wall -Wextra and see whether this shows
-anything wrong with your code that could be the cause instead of a bug
-in GCC.
+Before reporting that GCC compiles your code incorrectly, compile it
+with gcc -Wall -Wextra and see whether this shows anything
+wrong with your code.  Similarly, if compiling with
+-fno-strict-aliasing -fwrapv makes a difference, your code
+probably is not correct.
 
 Summarized bug reporting instructions
 

Re: libstdc++.exp patch

2011-04-26 Thread Paolo Carlini

On 04/26/2011 10:59 AM, Rainer Orth wrote:

Please separate the proc names by commas in the ChangeLog.

Indeed. I took care of this.

Paolo.


Patch ping

2011-04-26 Thread Jakub Jelinek
Hi!

http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01117.html
  - fix unwind info in presence of inline asm, 4.6/4.7

http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01264.html
  - typed DWARF stack

Jakub


Re: [PATCH] Canonicalize compares in combine [2/3] Modifications to try_combine()

2011-04-26 Thread Chung-Lin Tang
On 2011/4/26 02:08 AM, Jeff Law wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 04/22/11 09:21, Chung-Lin Tang wrote:
>> This patch is the main bulk of this submission. It modifies the compare
>> combining part of try_combine(), adding a call of
>> CANONICALIZE_COMPARISON into the entire logic.
>>
>> Also, instead of testing for XEXP(SET_SRC(PATTERN(i3)),1) == const0_rtx
>> at the top, it now allows CONST_INT_P(XEXP(SET_SRC(PATTERN(i3)),1)),
>> tries to adjust it by simplify_compare_const() from the last patch, and
>> then tests if op1 == const0_rtx. This is a small improvement in some cases.
>>
>> (if you remove the call to simplify_compare_const(), and if
>> CANONICALIZE_COMPARISON is not defined for the target, then this entire
>> patch should be an 'idempotent patch', nothing should be changed to the
>> effective combine results)
>>
>> One issue that I would like to RFC, is the use of
>> CANONICALIZE_COMPARISON here; I'm afraid I might be abusing it. Since
>> added_sets_2 is set here, the value of i2src/op0 is needed afterwards.
>> This might not be conformant to the description of
>> CANONICALIZE_COMPARISON in the internals manual, which doesn't say it
>> can't trash op0 under arbitrary conditions while only preserving the
>> comparison result.
>>
>> OTOH, I don't see another suitable macro/hook (with a close enough
>> meaning), and the current definitions of CANONICALIZE_COMPARISON across
>> the targets do not seem to clash with my use here. Does this macro use
>> look okay, or does this justify creating a new one?

Hi Jeff, thanks for reviewing this quite convoluted patch :)

> You seem to have removed the block comment (which was originally within
> a SELECT_CC_MODE block).  I can see why, but ISTM you need some comments
> to improve the readability of this code.  The code in the if
> (cc_use_loc) block, it appears you're updating the cc user, a comment to
> that effect and why is appropriate.
> 
> Following that block, you're actually changing the current insn, again a
> comment indicating that would be helpful in making the code easier to read.
> 

Sure, I'll try to add more clearer comments; and maybe someone else
could also see if my explanations are consistent with the transforms
intended.

> With regards to CANONICALIZE_COMPARISON; I think you're OK.  As far as I
> can tell, you aren't changing the value of op0, you're just changing its
> form.

Yes I'm not doing anything weird here, although the definition of the
CANONICALIZE_COMPARISON macro does not seem to forbid (other ports) from
doing so, as long as the comparison result is equivalent. It is
currently called only at the end of simplify_comparison(), which itself
possibly modifies the compare operands.

Considering not a lot of targets currently use CANONICALIZE_COMPARISON,
maybe it would be feasible to slightly change its interface? Maybe
adding a bool parameter to indicate whether the individual operands have
to be retained equivalent.

> 
> I've generally found that avoiding const0_rtx is wise.  Instead I
> suggest using CONST0_RTX (mode) to get the constant in the proper mode.
> 

Do you mean the (op1 == const0_rtx) test?

> Given the tangled mess this code happens to be, could you please do a
> bootstrap test on target with and without SELECT_CC_MODE.  x86 would be
> a great example of the former, powerpc the latter (use the build farm if
> you need to).   For ppc, just bootstrapping would be fine; I don't think
> a full regression test is needed, just some verification that we don't
> break ppc build should be sufficient.
> 

Bootstrap and test on x86 is completed already, both 32 and 64 bit.
Bootstrap on ARM itself is also completed, using a Pandaboard. I'll try
doing a ppc build too.

Thanks,
Chung-Lin




Re: [Patch,AVR]: Solve PR42210

2011-04-26 Thread Georg-Johann Lay
Richard Henderson schrieb:
> On 04/21/2011 05:31 AM, Georg-Johann Lay wrote:
>> +;; Some combiner patterns dealing with bits.
>> +;; See PR42210
>> +
>> +;; Move bit $3.$4 into bit $0.$4
>> +(define_insn "*movbitqi.1-6.a"
> ...
>> +(define_insn "*movbitqi.1-6.b"
> ...
>> +(define_insn "*movbitqi.0"
> ...
>> +(define_insn "*movbitqi.7"
> 
> This looks to be way more complicated than necessary.  Consider implementing 
> the
> extzv and insv named patterns, and using zero_extract properly.

Hi, I added some more test cases, see

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42210#c2

The case of setting bits in bitfield is easy, but for many AVRs there
is no header that defines SFRs via bitfields: there are just defines
for SFR address and bit position so that user code often contains bulk
of AND/OR/SHIFT/NOT etc. As the SFRs are volatile, insv expander skips
them and a combine pattern must care of them. Omitting the complicated
bit-plethora patterns I still see long, slow shift loops for HI. So
the patch still includes them.

> E.g. the following, lightly tested.  Looking again at the comment on your last
> pattern, it looks like that one would still need to be included.

Some lines are longer than 79 chars; I prefered legibility as there
are already long lines in avr.md, anyway.
The snip "INTVAL(operands[...])" occurs more than 50 times in the
machine description. Wouln't it be good to have an abbreviation like
#define OPVAL(n) INTVAL(operands[n])) defined in, e.g. avr-protos.h?

> +(define_insn "*movbitqi_ext_reg"
> +  [(set (zero_extract:QI
> +   (match_operand:QI 0 "register_operand" "+*d,*d,r,r,r")
> +   (const_int 1)
> +   (match_operand 1 "const_0_to_7_operand" ""))
> + (match_operand:QI 2 "nonme

Why do you use "*d" as constraint and not "d"?

> r~

Johann

PR target/42210

* config/avr/predicates.md (const1_operand, const_0_to_7_operand):
New predicates.

* config/avr/avr.md ("insv"): New insn expander.
("*movbitqi.1-6.a", "*movbitqi.1-6.b", "*movbitqi.0", "*insv.io",
"*insv.not.io", "*insv.reg"): New insns.


Index: config/avr/predicates.md
===
--- config/avr/predicates.md	(Revision 172902)
+++ config/avr/predicates.md	(Arbeitskopie)
@@ -62,6 +62,17 @@ (define_predicate "const0_operand"
   (and (match_code "const_int,const_double")
(match_test "op == CONST0_RTX (mode)")))
 
+;; Return 1 if OP is the one constant integer for MODE.
+(define_predicate "const1_operand"
+  (and (match_code "const_int")
+   (match_test "op == CONST1_RTX (mode)")))
+
+
+;; Return 1 if OP is constant integer 0..7 for MODE.
+(define_predicate "const_0_to_7_operand"
+  (and (match_code "const_int")
+   (match_test "IN_RANGE (INTVAL (op), 0, 7)")))
+
 ;; Returns true if OP is either the constant zero or a register.
 (define_predicate "reg_or_0_operand"
   (ior (match_operand 0 "register_operand")
Index: config/avr/avr.md
===
--- config/avr/avr.md	(Revision 172902)
+++ config/avr/avr.md	(Arbeitskopie)
@@ -3388,3 +3388,119 @@ (define_insn "fmulsu"
 	clr __zero_reg__"
   [(set_attr "length" "3")
(set_attr "cc" "clobber")])
+
+
+;; Some combiner patterns dealing with bits.
+;; See PR42210
+
+;; Move bit $3.$4 into bit $0.$4
+(define_insn "*movbitqi.1-6.a"
+  [(set (match_operand:QI 0 "register_operand"   "=r")
+(ior:QI (and:QI (match_operand:QI 1 "register_operand""0")
+(match_operand:QI 2 "single_zero_operand" "n"))
+(and:QI (ashift:QI (match_operand:QI 3 "register_operand" "r")
+   (match_operand:QI 4 "const_0_to_7_operand" "n"))
+(match_operand:QI 5 "single_one_operand"  "n"]
+  "optimize
+   && INTVAL(operands[4]) == exact_log2 (INTVAL(operands[5]) & GET_MODE_MASK (QImode))
+   && INTVAL(operands[4]) == exact_log2 (~INTVAL(operands[2]) & GET_MODE_MASK (QImode))"
+  "bst %3,0\;bld %0,%4"
+  [(set_attr "length" "2")
+   (set_attr "cc" "none")])
+
+;; Move bit $3.0 into bit $0.$4
+;; Variation of above. Unfortunately, there is no canonicalized representation
+;; of moving around bits.  So what we see here depends on how user writes down
+;; bit manipulations.
+(define_insn "*movbitqi.1-6.b"
+  [(set (match_operand:QI 0 "register_operand""=r")
+(ior:QI (and:QI (match_operand:QI 1 "register_operand" "0")
+(match_operand:QI 2 "single_zero_operand"  "n"))
+(ashift:QI (and:QI (match_operand:QI 3 "register_operand"  "r")
+   (const_int 1))
+   (match_operand:QI 4 "const_0_to_7_operand"  "n"]
+  "optimize
+   && INTVAL(operands[4]) == exact_log2 (~INTVAL(operands[2]) & GET_MODE_MASK (QIm

Re: [RFC] Context sensitive inline analysis

2011-04-26 Thread Jan Hubicka
> Honza,
> 
> This patch causes a bootstrap failure when building libstdc++ on AIX:
> 
> In file included from
> /farm/dje/src/src/libstdc++-v3/include/precompiled/stdc++.h:94:0:
> /tmp/20110423/powerpc-ibm-aix5.3.0.0/libstdc++-v3/include/valarray:1163:1:
> internal compiler error: vector VEC(tree,base) index domain error, in
> evaulate_conditions_for_edge at ipa-inline-analysis.c:466

Hi,
similar error was reported for HP, too.  I will look into it now.  I hoped it
is same as the Toon's problem (that hack I removed caused quite bad propagation
across unitialized datastructured)

Yesterday I analyzed last problem I reproduced Mozilla and those are due to the
fact that we don't do type compatibility checking when doing indirect inlining
and in LTO type merging. So different than this one.
> 
> I do not know if this is related to the WPA failure reported by Toon.
> 
> Also, I think you mean "evaluate" not "evaulate" in the description
> and new function names.
Duh, will fix that!
Honza
> 
> Thanks, David


[PATCH] Fix PR48731

2011-04-26 Thread Richard Guenther

This adds a missing check for ->local.inlinable to cgraph_flatten.
Honza fixed this on trunk by factoring out the checks.

Bootstrapped and tested on x86_64-unknown-linux-gnu, installed.

Richard.

2011-04-26  Richard Guenther  

PR tree-optimization/48731
* ipa-inline.c (cgraph_flatten): Test if function is inlinable.

* gcc.dg/torture/pr48731.c: New testcase.

Index: gcc/ipa-inline.c
===
*** gcc/ipa-inline.c(revision 172962)
--- gcc/ipa-inline.c(working copy)
*** cgraph_flatten (struct cgraph_node *node
*** 1337,1342 
--- 1337,1345 
  continue;
}
  
+   if (!e->callee->local.inlinable)
+   continue;
+ 
/* We've hit cycle?  It is time to give up.  */
if (e->callee->aux)
{
Index: gcc/testsuite/gcc.dg/torture/pr48731.c
===
*** gcc/testsuite/gcc.dg/torture/pr48731.c  (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr48731.c  (revision 0)
***
*** 0 
--- 1,24 
+ /* { dg-do compile } */
+ 
+ #include 
+ 
+ int blah(int a, ...)
+ {
+   va_list va;
+   va_start(va,a);
+   if (a == 0)
+ return -1;
+   else 
+ {
+   int i;
+   for (i = 0; i < a; i++)
+   va_arg(va,int);
+   return va_arg(va,int);
+ }
+ }
+ 
+ __attribute((flatten))
+ int blah2(int b, int c)
+ {
+   return blah(2, b, c);
+ }


Re: [google] Port self-assign warning to google/main branch (issue4442075)

2011-04-26 Thread Diego Novillo
On Fri, Apr 22, 2011 at 16:08, Le-Chun Wu  wrote:
> 2011-04-22  Le-Chun Wu  
>
> gcc/c-family/ChangeLog:
>        * c-common.c (check_for_self_assign): New function.
>        * c-common.h: New function declaration.
>        * c.opt: New option.
>
> gcc/ChangeLog:
>        * c-parser.c (c_parser_declaration_or_fndef): Check for self-assign.
>        (c_parser_expr_no_commas): Check for self-assign.
>        * common.opt: New option.
>        * doc/invoke.texi: Documentation for new options.
>        * fold-const.c (operand_equal_p): Allow operands without typres to
>        compare.
>        (fold_unary_loc_1): Renamed from fold_unary_loc.
>        (fold_unary_loc): New wrapper function.
>        (fold_binary_loc_1): Renamed from fold_binary_loc.
>        (fold_binary_loc): New wrapper function.
>        (fold_ternary_loc_1): Renamed from fold_ternary_loc.
>        (fold_ternary_loc): New wrapper function.
>        * tree.h (struct tree_base): New flag for folded expr.
>        (enum operand_equal_flag): New flags.
>
> gcc/cp/ChangeLog:
>        * init.c (perform_member_init): Check for self-assign.
>        * parser.c (expr_is_pod): New function.
>        (cp_parser_assignment_expression): Check for self-assign.
>        (cp_parser_init_declarator): Check for self-assign.
>
> gcc/testsuite/ChangeLog:
>        * testsuite/g++.dg/plugin/selfassign.c (check_self_assign): Renamed
>        from warn_self_assign.
>        (execute_warn_self_assign): Call a function by its new name.
>        * testsuite/g++.dg/warn/Wself-assign-1.C: New test case.
>        * testsuite/g++.dg/warn/Wself-assign-2.C: Likewise.
>        * testsuite/g++.dg/warn/Wself-assign-3.C: Likewise.
>        * testsuite/g++.dg/warn/Wself-assign-4.C: Likewise.
>        * testsuite/g++.dg/warn/Wself-assign-5.C: Likewise.
>        * testsuite/g++.dg/warn/Wself-assign-non-pod-1.C: Likewise.
>        * testsuite/g++.dg/warn/Wself-assign-non-pod-2.C: Likewise.
>        * testsuite/g++.dg/warn/Wself-assign-non-pod-3.C: Likewise.
>        * testsuite/g++.dg/warn/Wself-assign-non-pod-4.C: Likewise.
>        * testsuite/g++.dg/warn/Wself-assign-non-pod-5.C: Likewise.
>        * testsuite/gcc.dg/plugin/selfassign.c (check_self_assign): Renamed
>        from warn_self_assign.
>        (execute_warn_self_assign): Call a function by its new name.:
>        * testsuite/gcc.dg/wself-assign-1.c: New test case.
>        * testsuite/gcc.dg/wself-assign-2.c: Likewise.

OK.


Diego.


Re: [google]Pass --save-temps to the assembler (issue4436049)

2011-04-26 Thread Diego Novillo
On Mon, Apr 25, 2011 at 15:00, Easwaran Raman  wrote:

> 2011-04-25  Easwaran Raman  
>
>        * gcc/gcc.c (asm_options): Pass --save-temps to assembler
>        when invoked with -save-temps= option.

OK.


Diego.


[PATCH] Fix eliminate_redundant_comparison (PR tree-optimization/48734)

2011-04-26 Thread Jakub Jelinek
Hi!

eliminate_redundant_comparison calls maybe_fold_{and,or}_comparisons,
which calls fold.  Expecting that the result is either INTEGER_CST or
a comparison with gimple vals is just bad assumption, fold can create
all kinds of canonicalizations.

While we can perhaps handle a few of them here, I'm slightly worried
to add too much more stuff using build_and_add_sum etc., as that might
increase register pressure.

This patch just gives up if it can't handle it instead of ICEing,
in the future as follow-up we could perhaps handle a few cases.
Given that this ICE hit us only once after so long and never on real-world
code so far, I'd say so it isn't that urgent though.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.6?

2011-04-26  Jakub Jelinek  

PR tree-optimization/48734
* tree-ssa-reassoc.c (eliminate_redundant_comparison): Give up
if return value from maybe_fold_*_comparsions isn't something
the code is prepared to handle.

* gcc.c-torture/compile/pr48734.c: New test.

--- gcc/tree-ssa-reassoc.c.jj   2011-02-15 15:42:27.0 +0100
+++ gcc/tree-ssa-reassoc.c  2011-04-26 09:32:51.0 +0200
@@ -1279,6 +1279,20 @@ eliminate_redundant_comparison (enum tre
   if (!useless_type_conversion_p (TREE_TYPE (curr->op), TREE_TYPE (t)))
t = fold_convert (TREE_TYPE (curr->op), t);
 
+  if (TREE_CODE (t) != INTEGER_CST
+ && !operand_equal_p (t, curr->op, 0))
+   {
+ enum tree_code subcode;
+ tree newop1, newop2;
+ if (!COMPARISON_CLASS_P (t))
+   continue;
+ extract_ops_from_tree (t, &subcode, &newop1, &newop2);
+ STRIP_USELESS_TYPE_CONVERSION (newop1);
+ STRIP_USELESS_TYPE_CONVERSION (newop2);
+ if (!is_gimple_val (newop1) || !is_gimple_val (newop2))
+   continue;
+   }
+
   if (dump_file && (dump_flags & TDF_DETAILS))
{
  fprintf (dump_file, "Equivalence: ");
--- gcc/testsuite/gcc.c-torture/compile/pr48734.c.jj2011-04-26 
09:34:38.0 +0200
+++ gcc/testsuite/gcc.c-torture/compile/pr48734.c   2011-04-26 
09:34:17.0 +0200
@@ -0,0 +1,11 @@
+/* PR tree-optimization/48734 */
+
+unsigned int
+foo (int x, unsigned int y, unsigned int z)
+{
+  z &= (x == -__INT_MAX__ - 1 ? x : -x) > y;
+  z &= (x == -__INT_MAX__ - 1 ? x : -x) > y;
+  z &= (x == -__INT_MAX__ - 1 ? x : -x) > y;
+  z &= (x == -__INT_MAX__ - 1 ? x : -x) > y;
+  return z;
+}

Jakub


Re: PING: PATCH: PR target/46770: Use .init_array/.fini_array sections

2011-04-26 Thread H.J. Lu
On Thu, Mar 31, 2011 at 7:57 AM, H.J. Lu  wrote:
> On Mon, Mar 21, 2011 at 11:40 AM, H.J. Lu  wrote:
>> On Mon, Mar 14, 2011 at 12:28 PM, H.J. Lu  wrote:
>>> On Thu, Jan 27, 2011 at 2:40 AM, Richard Guenther
>>>  wrote:
 On Thu, Jan 27, 2011 at 12:12 AM, H.J. Lu  wrote:
> On Tue, Dec 14, 2010 at 05:20:48PM -0800, H.J. Lu wrote:
>> This patch uses .init_array/.fini_array sections instead of
>> .ctors/.dtors sections if mixing .init_array/.fini_array and
>> .ctors/.dtors sections with init_priority works.
>>
>> It removes .ctors/.ctors sections from executables and DSOes, which will
>> remove one function call at startup time from each executable and DSO.
>> It should reduce image size and improve system startup time.
>>
>> If a platform with a working .init_array/.fini_array support needs a
>> different .init_array/.fini_array implementation, it can set
>> use_initfini_array to no.
>>
>> Since .init_array/.fini_array is a target feature. 
>> --enable-initfini-array
>> is default to no unless the native run-time test is passed.
>>
>> To pass the native run-time test, a linker with SORT_BY_INIT_PRIORITY
>> support is required.  The binutils patch is available at
>>
>> http://sourceware.org/ml/binutils/2010-12/msg00466.html
>
> Linker patch has been checked in.
>
>>
>> This patch passed 32bit/64bit regression test on Linux/x86-64.  Any
>> comments?
>>
>
> This updated patch fixes build on Linux/ia64 and should work on others.
> Any comments?

 Yes.  This is stage1 material.

>>>
>>> Here is the updated patch.  OK for trunk?
>>>
>>> Thanks.
>>>
>>>
>>> --
>>> H.J.
>>> 
>>> 2011-03-14  H.J. Lu  
>>>
>>>        PR target/46770
>>>        * acinclude.m4 (gcc_AC_INITFINI_ARRAY): Removed.
>>>
>>>        * config.gcc (use_initfini_array): New variable.
>>>        Use initfini-array.o if supported.
>>>
>>>        * crtstuff.c: Don't generate .ctors nor .dtors sections if
>>>        NO_CTORS_DTORS_SECTIONS is defined.
>>>
>>>        * configure.ac: Remove gcc_AC_INITFINI_ARRAY.  Add
>>>        --enable-initfini-array and check if .init_array can be used with
>>>        .ctors.
>>>
>>>        * configure: Regenerated.
>>>
>>>        * config/initfini-array.c: New.
>>>        * config/initfini-array.h: Likewise.
>>>        * config/t-initfini-array: Likewise.
>>>
>>>        * config/arm/arm.c (arm_asm_init_sections): Call
>>>        elf_initfini_array_init_sections if NO_CTORS_DTORS_SECTIONS
>>>        is defined.
>>>        * config/avr/avr.c (avr_asm_init_sections): Likewise.
>>>        * config/ia64/ia64.c (ia64_asm_init_sections): Likewise.
>>>        * config/mep/mep.c (mep_asm_init_sections): Likewise.
>>>        * config/microblaze/microblaze.c (microblaze_elf_asm_init_sections):
>>>        Likewise.
>>>        * config/rs6000/rs6000.c (rs6000_elf_asm_init_sections): Likewise.
>>>        * config/stormy16/stormy16.c (xstormy16_asm_init_sections):
>>>        Likewise.
>>>        * config/v850/v850.c (v850_asm_init_sections): Likewise.
>>>
>>
>> PING:
>>
>> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00760.html
>>
>
> Any comments?  Any objections?
>

Here is the patch updated for the current trunk.  OK for trunk?

Thanks.


-- 
H.J.
This patch uses .init_array/.fini_array sections instead of
.ctors/.dtors sections if mixing .init_array/.fini_array and
.ctors/.dtors sections with init_priority works.

It removes .ctors/.ctors sections from executables and DSOes, which will
remove one function call at startup time from each executable and DSO.
It should reduce image size and improve system startup time. 

If a platform with a working .init_array/.fini_array support needs a
different .init_array/.fini_array implementation, it can set
use_initfini_array to no.

Since .init_array/.fini_array is a target feature. --enable-initfini-array
is default to no unless the native run-time test is passed.

To pass the native run-time test, a linker with SORT_BY_INIT_PRIORITY
support is required.  The binutils patch is available at

http://sourceware.org/ml/binutils/2010-12/msg00466.html

This patch passed 32bit/64bit regression test on Linux/x86-64.

Thanks.

H.J.
---
2010-12-14  H.J. Lu  

PR target/46770
* acinclude.m4 (gcc_AC_INITFINI_ARRAY): Removed.

* config.gcc (use_initfini_array): New variable.
Use initfini-array.o if supported.

* crtstuff.c: Don't generate .ctors nor .dtors sections if
NO_CTORS_DTORS_SECTIONS is defined.

* configure.ac: Remove gcc_AC_INITFINI_ARRAY.  Add
--enable-initfini-array and check if .init_array can be used with
.ctors.

* configure: Regenerated.

* config/initfini-array.c: New.
* config/initfini-array.h: Likewise.
* config/t-initfini-array: Likewise.

* config/arm/arm.c (arm_asm_init_sections): Call
elf_initfini_array_init_sections if

[PATCH, i386]: Remove ext_QIreg_nomode_operands predicate

2011-04-26 Thread Uros Bizjak
Hello!

We can use ext_QIreg_operands instead.  These predicates automatically
include mode checks with VOIDmode override.

Also, clean predicates.md a bit while there.

2011-04-26  Uros Bizjak  

* config/i386/predicates.md (ext_QIreg_operand): Remove extra
mode check.
(ext_QIreg_nomode_operands): Remove.
* config/i386/i386.md (*anddi_1): Use ext_QIreg_operand.
(*andsi_1): Ditto.
(*andhi_1): Ditto.

Tested on x86_64-pc-linux-gnu  {,-m32}, committed to mainline SVN.

Uros.
Index: predicates.md
===
--- predicates.md   (revision 172954)
+++ predicates.md   (working copy)
@@ -86,16 +86,9 @@
 ;; %[abcd][hl].
 (define_predicate "ext_QIreg_operand"
   (and (match_code "reg")
-   (match_test "TARGET_64BIT
-   && GET_MODE (op) == QImode
-   && REGNO (op) > BX_REG")))
+   (match_test "TARGET_64BIT")
+   (match_test "REGNO (op) > BX_REG")))
 
-;; Similarly, but don't check mode of the operand.
-(define_predicate "ext_QIreg_nomode_operand"
-  (and (match_code "reg")
-   (match_test "TARGET_64BIT
-   && REGNO (op) > BX_REG")))
-
 ;; Return true if op is not xmm0 register.
 (define_predicate "reg_not_xmm0_operand"
   (match_operand 0 "register_operand")
@@ -391,7 +384,8 @@
 
 ;; Return true if OP is nonmemory operand acceptable by movabs patterns.
 (define_predicate "x86_64_movabs_operand"
-  (if_then_else (match_test "!TARGET_64BIT || !flag_pic")
+  (if_then_else (not (and (match_test "TARGET_64BIT")
+ (match_test "flag_pic")))
 (match_operand 0 "nonmemory_operand")
 (ior (match_operand 0 "register_operand")
 (and (match_operand 0 "const_double_operand")
@@ -483,7 +477,7 @@
 ;; scripts means that we can't be sure of that in general, so assume
 ;; that @GOTOFF is never valid on VxWorks.
 (define_predicate "gotoff_operand"
-  (and (match_test "!TARGET_VXWORKS_RTP")
+  (and (not (match_test "TARGET_VXWORKS_RTP"))
(match_operand 0 "local_symbolic_operand")))
 
 ;; Test for various thread-local symbols.
@@ -611,7 +605,8 @@
 ;; Match 0 or 1.
 (define_predicate "const_0_to_1_operand"
   (and (match_code "const_int")
-   (match_test "op == const0_rtx || op == const1_rtx")))
+   (ior (match_test "op == const0_rtx")
+   (match_test "op == const1_rtx"
 
 ;; Match 0 to 3.
 (define_predicate "const_0_to_3_operand"
@@ -696,7 +691,8 @@
 ;; Match exactly one bit in 2-bit mask.
 (define_predicate "const_pow2_1_to_2_operand"
   (and (match_code "const_int")
-   (match_test "INTVAL (op) == 1 || INTVAL (op) == 2")))
+   (ior (match_test "op == const1_rtx")
+   (match_test "op == const2_rtx"
 
 ;; Match exactly one bit in 4-bit mask.
 (define_predicate "const_pow2_1_to_8_operand"
@@ -737,7 +733,8 @@
 (define_predicate "reg_or_pm1_operand"
   (ior (match_operand 0 "register_operand")
(and (match_code "const_int")
-   (match_test "op == const1_rtx || op == constm1_rtx"
+   (ior (match_test "op == const1_rtx")
+(match_test "op == constm1_rtx")
 
 ;; True if OP is acceptable as operand of DImode shift expander.
 (define_predicate "shiftdi_operand"
@@ -984,8 +981,8 @@
 
 (define_predicate "sse_comparison_operator"
   (ior (match_code "eq,ne,lt,le,unordered,unge,ungt,ordered")
-   (and (match_code "ge,gt,uneq,unle,unlt,ltgt")
-   (match_test "TARGET_AVX"
+   (and (match_test "TARGET_AVX")
+   (match_code "ge,gt,uneq,unle,unlt,ltgt"
 
 (define_predicate "ix86_comparison_int_operator"
   (match_code "ne,eq,ge,gt,le,lt"))
Index: i386.md
===
--- i386.md (revision 172954)
+++ i386.md (working copy)
@@ -7932,7 +7932,7 @@
  (if_then_else
(and (eq_attr "type" "imovx")
(and (ne (symbol_ref "INTVAL (operands[2]) == 0xff") (const_int 0))
-(match_operand 1 "ext_QIreg_nomode_operand" "")))
+(match_operand 1 "ext_QIreg_operand" "")))
(const_string "1")
(const_string "*")))
(set_attr "mode" "SI,DI,DI,SI")])
@@ -7976,7 +7976,7 @@
  (if_then_else
(and (eq_attr "type" "imovx")
(and (ne (symbol_ref "INTVAL (operands[2]) == 0xff") (const_int 0))
-(match_operand 1 "ext_QIreg_nomode_operand" "")))
+(match_operand 1 "ext_QIreg_operand" "")))
(const_string "1")
(const_string "*")))
(set_attr "length_immediate" "*,*,0")
@@ -8019,7 +8019,7 @@
(set (attr "prefix_rex")
  (if_then_else
(and (eq_attr "type" "imovx")
-   (match_operand 1 "ext_QIreg_nomode_operand" ""))
+   (match_operand 1 "ext_QIreg_operand" ""))
(const_string "1")
(const_string "*")))
(set_attr "mode" "HI,HI,SI")])


Re: [PATCH] Fix eliminate_redundant_comparison (PR tree-optimization/48734)

2011-04-26 Thread Richard Guenther
On Tue, Apr 26, 2011 at 3:02 PM, Jakub Jelinek  wrote:
> Hi!
>
> eliminate_redundant_comparison calls maybe_fold_{and,or}_comparisons,
> which calls fold.  Expecting that the result is either INTEGER_CST or
> a comparison with gimple vals is just bad assumption, fold can create
> all kinds of canonicalizations.
>
> While we can perhaps handle a few of them here, I'm slightly worried
> to add too much more stuff using build_and_add_sum etc., as that might
> increase register pressure.
>
> This patch just gives up if it can't handle it instead of ICEing,
> in the future as follow-up we could perhaps handle a few cases.
> Given that this ICE hit us only once after so long and never on real-world
> code so far, I'd say so it isn't that urgent though.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.6?

Ok.

Thanks,
RIchard.

> 2011-04-26  Jakub Jelinek  
>
>        PR tree-optimization/48734
>        * tree-ssa-reassoc.c (eliminate_redundant_comparison): Give up
>        if return value from maybe_fold_*_comparsions isn't something
>        the code is prepared to handle.
>
>        * gcc.c-torture/compile/pr48734.c: New test.
>
> --- gcc/tree-ssa-reassoc.c.jj   2011-02-15 15:42:27.0 +0100
> +++ gcc/tree-ssa-reassoc.c      2011-04-26 09:32:51.0 +0200
> @@ -1279,6 +1279,20 @@ eliminate_redundant_comparison (enum tre
>       if (!useless_type_conversion_p (TREE_TYPE (curr->op), TREE_TYPE (t)))
>        t = fold_convert (TREE_TYPE (curr->op), t);
>
> +      if (TREE_CODE (t) != INTEGER_CST
> +         && !operand_equal_p (t, curr->op, 0))
> +       {
> +         enum tree_code subcode;
> +         tree newop1, newop2;
> +         if (!COMPARISON_CLASS_P (t))
> +           continue;
> +         extract_ops_from_tree (t, &subcode, &newop1, &newop2);
> +         STRIP_USELESS_TYPE_CONVERSION (newop1);
> +         STRIP_USELESS_TYPE_CONVERSION (newop2);
> +         if (!is_gimple_val (newop1) || !is_gimple_val (newop2))
> +           continue;
> +       }
> +
>       if (dump_file && (dump_flags & TDF_DETAILS))
>        {
>          fprintf (dump_file, "Equivalence: ");
> --- gcc/testsuite/gcc.c-torture/compile/pr48734.c.jj    2011-04-26 
> 09:34:38.0 +0200
> +++ gcc/testsuite/gcc.c-torture/compile/pr48734.c       2011-04-26 
> 09:34:17.0 +0200
> @@ -0,0 +1,11 @@
> +/* PR tree-optimization/48734 */
> +
> +unsigned int
> +foo (int x, unsigned int y, unsigned int z)
> +{
> +  z &= (x == -__INT_MAX__ - 1 ? x : -x) > y;
> +  z &= (x == -__INT_MAX__ - 1 ? x : -x) > y;
> +  z &= (x == -__INT_MAX__ - 1 ? x : -x) > y;
> +  z &= (x == -__INT_MAX__ - 1 ? x : -x) > y;
> +  return z;
> +}
>
>        Jakub
>


PING: PATCH: PR other/48007: Unwind library doesn't work with UNITS_PER_WORD > sizeof (void *)

2011-04-26 Thread H.J. Lu
On Sat, Apr 9, 2011 at 6:52 PM, H.J. Lu  wrote:
> On Thu, Mar 24, 2011 at 12:15 AM, H.J. Lu  wrote:
>> On Wed, Mar 23, 2011 at 12:22 PM, Ulrich Weigand  wrote:
>>> Richard Henderson wrote:
 Because, really, if we consider the structure truly public, we can't even
 change the number of registers for a given port to support new features of
 the cpu.
>>>
>>> Indeed, and I remember we got bitten by that a long time ago, which is why
>>> s390.h now has this comment:
>>>
>>> /* Number of hardware registers that go into the DWARF-2 unwind info.
>>>   To avoid ABI incompatibility, this number must not change even as
>>>   'fake' hard registers are added or removed.  */
>>> #define DWARF_FRAME_REGISTERS 34
>>>
 I don't suppose there's any way that we can declare these old
 programs Just Broken, and drop this compatibility stuff?
>>>
>>> I wouldn't like that ... we did run into this problem in the wild, and
>>> some s390 users really run very old programs for some reason.
>>>
>>> However, I'm wondering: this bug that leaked the implementation of
>>> _Unwind_Context only ever affected the *original* version of the
>>> structure -- it was fixed before the extended context was ever
>>> added, right?
>>>
>>> If this is true, we'd still need to keep the original context format
>>> unchanged, but we'd be free to modify the *extended* format at any
>>> time, without ABI considerations and need for further versioning ...
>>>
>>
>> From what I can tell, the issues are:
>>
>> 1. _Unwind_Context is supposed to be opaque and we are free to
>> change it.  We should be able to extend DWARF_FRAME_REGISTERS
>> to support the new hard registers if needed, without breaking binary
>> compatibility.
>> 2.  _Unwind_Context was leaked and wasn't really opaque.  To
>> provide backward binary compatibility, we are stuck with what we
>> had.
>>
>> Is that possible to implement something along the line:
>>
>> 1. Add some bits to _Unwind_Context so that we can detect
>> the leaked _Unwind_Context.
>> 2. When a leaked _Unwind_Context is detected at run-time,
>> as a compile time option, a target can either provide binary
>> compatibility or issue a run-time error.
>
> This is the attempt to implement it.  Any comments?
>
> Thanks.
>
> --
> H.J.
> --
> 2011-04-09  H.J. Lu  
>
>        PR other/48007
>        * unwind-dw2.c (UNIQUE_UNWIND_CONTEXT): New.
>        (_Unwind_Context): If UNIQUE_UNWIND_CONTEXT is defined, add
>        dwarf_reg_size_table and value, remove version and by_value.
>        (EXTENDED_CONTEXT_BIT): Don't define if UNIQUE_UNWIND_CONTEXT
>        is defined.
>        (_Unwind_IsExtendedContext): Likewise.
>        (_Unwind_GetGR): Support UNIQUE_UNWIND_CONTEXT.
>        (_Unwind_SetGR): Likewise.
>        (_Unwind_GetGRPtr): Likewise.
>        (_Unwind_SetGRPtr): Likewise.
>        (_Unwind_SetGRValue): Likewise.
>        (_Unwind_GRByValue): Likewise.
>        (__frame_state_for): Initialize dwarf_reg_size_table field if
>        UNIQUE_UNWIND_CONTEXT is defined.
>        (uw_install_context_1): Likewise.  Support UNIQUE_UNWIND_CONTEXT.
>

PING.

-- 
H.J.


[PATCH] Fix VTA ICE after fixup_noreturn_call (PR debug/48768)

2011-04-26 Thread Jakub Jelinek
Hi!

fixup_noreturn_call when removing LHS of a noreturn call does:
  /* We need to remove SSA name to avoid checking errors.
 All uses are dominated by the noreturn and thus will
 be removed afterwards.
 We proactively remove affected non-PHI statements to avoid
 fixup_cfg from trying to update them and crashing.  */
  if (TREE_CODE (op) == SSA_NAME)
{
  use_operand_p use_p;
  imm_use_iterator iter;
  gimple use_stmt;
  bitmap_iterator bi;
  unsigned int bb_index;

  bitmap blocks = BITMAP_ALLOC (NULL);

  FOR_EACH_IMM_USE_STMT (use_stmt, iter, op)
{
  if (gimple_code (use_stmt) != GIMPLE_PHI)
bitmap_set_bit (blocks, gimple_bb (use_stmt)->index);
  else
FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
  SET_USE (use_p, error_mark_node);
}
which is fine because all the uses will be cleaned up RSN afterwards.
Unfortunately, during the cleanup VTA triggers and tries to add DEBUG exprs,
if there is a degenerate PHI which contains just error_mark_node set above
unfortunately that results in DEBUG something => <<< error >>>, which isn't
valid.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk/4.6?

2011-04-26  Jakub Jelinek  

PR debug/48768
* tree-ssa.c (insert_debug_temp_for_var_def): If degenerate_phi_result
is error_mark_node, set value to NULL.

* gcc.dg/pr48768.c: New test.

--- gcc/tree-ssa.c.jj   2011-04-13 10:54:49.0 +0200
+++ gcc/tree-ssa.c  2011-04-26 10:56:28.0 +0200
@@ -352,6 +352,10 @@ insert_debug_temp_for_var_def (gimple_st
   value = degenerate_phi_result (def_stmt);
   if (value && walk_tree (&value, find_released_ssa_name, NULL, NULL))
value = NULL;
+  /* error_mark_node is what fixup_noreturn_call changes PHI arguments
+to.  */
+  else if (value == error_mark_node)
+   value = NULL;
 }
   else if (is_gimple_assign (def_stmt))
 {
--- gcc/testsuite/gcc.dg/pr48768.c.jj   2011-04-26 10:58:17.0 +0200
+++ gcc/testsuite/gcc.dg/pr48768.c  2011-04-26 10:57:30.0 +0200
@@ -0,0 +1,38 @@
+/* PR debug/48768 */
+/* { dg-do compile } */
+/* { dg-options "-O -fcompare-debug" } */
+
+int a, b;
+
+int
+bar (void)
+{
+  int i, j = 1;
+  for (i = 0; i != 10; i++)
+{
+lab:
+  if (i)
+   {
+ int *k = &j;
+   }
+  else if (j)
+   goto lab;
+}
+  return 1;
+}
+
+inline int
+foo (int x)
+{
+  unsigned int c = x;
+  int d = x;
+  if (bar ())
+for (; c; c++)
+  while (x >= 0)
+   if (foo (d) >= 0)
+ {
+   d = bar ();
+   a = b ? b : 1;
+ }
+  return 0;
+}

Jakub


Re: [PATCH] Fix PR48753

2011-04-26 Thread H.J. Lu
On Tue, Apr 26, 2011 at 3:02 AM, Richard Guenther  wrote:
>
> Value-profiling now creates proper integer constants.
>
> Installed.
>
> Richard.
>
> 2011-04-26  Richard Guenther  
>
>        PR testsuite/48753
>        * gcc.dg/tree-prof/val-prof-2.c: Adjust.
>
> Index: gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c
> ===
> --- gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c (revision 172953)
> +++ gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c (working copy)
> @@ -26,7 +26,7 @@ main ()
>  /* { dg-final-use { scan-ipa-dump "Mod power of 2 transformation on insn" 
> "tree_profile_ipa" } } */
>  /* This is part of code checking that n is power of 2, so we are sure that 
> the transformation
>    didn't get optimized out.  */
> -/* { dg-final-use { scan-tree-dump "n_\[0-9\]* \\+ 0x" "optimized"} } */
> +/* { dg-final-use { scan-tree-dump "n_\[0-9\]* \\+ 4294967295" "optimized"} 
> } */
>  /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
>  /* { dg-final-use { cleanup-tree-dump "optimized" } } */
>  /* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */
>

This fails for 32bit.

-- 
H.J.


Re: [PATCH] Fix VTA ICE after fixup_noreturn_call (PR debug/48768)

2011-04-26 Thread Richard Guenther
On Tue, Apr 26, 2011 at 3:08 PM, Jakub Jelinek  wrote:
> Hi!
>
> fixup_noreturn_call when removing LHS of a noreturn call does:
>      /* We need to remove SSA name to avoid checking errors.
>         All uses are dominated by the noreturn and thus will
>         be removed afterwards.
>         We proactively remove affected non-PHI statements to avoid
>         fixup_cfg from trying to update them and crashing.  */
>      if (TREE_CODE (op) == SSA_NAME)
>        {
>          use_operand_p use_p;
>          imm_use_iterator iter;
>          gimple use_stmt;
>          bitmap_iterator bi;
>          unsigned int bb_index;
>
>          bitmap blocks = BITMAP_ALLOC (NULL);
>
>          FOR_EACH_IMM_USE_STMT (use_stmt, iter, op)
>            {
>              if (gimple_code (use_stmt) != GIMPLE_PHI)
>                bitmap_set_bit (blocks, gimple_bb (use_stmt)->index);
>              else
>                FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
>                  SET_USE (use_p, error_mark_node);
>            }
> which is fine because all the uses will be cleaned up RSN afterwards.
> Unfortunately, during the cleanup VTA triggers and tries to add DEBUG exprs,
> if there is a degenerate PHI which contains just error_mark_node set above
> unfortunately that results in DEBUG something => <<< error >>>, which isn't
> valid.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk/4.6?

Ok.

Thanks,
Richard.

> 2011-04-26  Jakub Jelinek  
>
>        PR debug/48768
>        * tree-ssa.c (insert_debug_temp_for_var_def): If degenerate_phi_result
>        is error_mark_node, set value to NULL.
>
>        * gcc.dg/pr48768.c: New test.
>
> --- gcc/tree-ssa.c.jj   2011-04-13 10:54:49.0 +0200
> +++ gcc/tree-ssa.c      2011-04-26 10:56:28.0 +0200
> @@ -352,6 +352,10 @@ insert_debug_temp_for_var_def (gimple_st
>       value = degenerate_phi_result (def_stmt);
>       if (value && walk_tree (&value, find_released_ssa_name, NULL, NULL))
>        value = NULL;
> +      /* error_mark_node is what fixup_noreturn_call changes PHI arguments
> +        to.  */
> +      else if (value == error_mark_node)
> +       value = NULL;
>     }
>   else if (is_gimple_assign (def_stmt))
>     {
> --- gcc/testsuite/gcc.dg/pr48768.c.jj   2011-04-26 10:58:17.0 +0200
> +++ gcc/testsuite/gcc.dg/pr48768.c      2011-04-26 10:57:30.0 +0200
> @@ -0,0 +1,38 @@
> +/* PR debug/48768 */
> +/* { dg-do compile } */
> +/* { dg-options "-O -fcompare-debug" } */
> +
> +int a, b;
> +
> +int
> +bar (void)
> +{
> +  int i, j = 1;
> +  for (i = 0; i != 10; i++)
> +    {
> +    lab:
> +      if (i)
> +       {
> +         int *k = &j;
> +       }
> +      else if (j)
> +       goto lab;
> +    }
> +  return 1;
> +}
> +
> +inline int
> +foo (int x)
> +{
> +  unsigned int c = x;
> +  int d = x;
> +  if (bar ())
> +    for (; c; c++)
> +      while (x >= 0)
> +       if (foo (d) >= 0)
> +         {
> +           d = bar ();
> +           a = b ? b : 1;
> +         }
> +  return 0;
> +}
>
>        Jakub
>


Re: [PATCH] Fix PR48753

2011-04-26 Thread Jakub Jelinek
On Tue, Apr 26, 2011 at 12:02:38PM +0200, Richard Guenther wrote:
> 
> Value-profiling now creates proper integer constants.

This still fails on 32-bit HWI hosts, like i686-linux.

Fixed thusly, regtested on x86_64-linux and i686-linux,
committed to trunk:

2011-04-26  Jakub Jelinek  

PR testsuite/48753
* gcc.dg/tree-prof/val-prof-2.c: Adjust for 32-bit HWI.

--- gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c (revision 172965)
+++ gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c (working copy)
@@ -26,7 +26,7 @@ main ()
 /* { dg-final-use { scan-ipa-dump "Mod power of 2 transformation on insn" 
"tree_profile_ipa" } } */
 /* This is part of code checking that n is power of 2, so we are sure that the 
transformation
didn't get optimized out.  */
-/* { dg-final-use { scan-tree-dump "n_\[0-9\]* \\+ 4294967295" "optimized"} } 
*/
+/* { dg-final-use { scan-tree-dump "n_\[0-9\]* \\+ (4294967295|0x0*)" 
"optimized"} } */
 /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
 /* { dg-final-use { cleanup-tree-dump "optimized" } } */
 /* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */


Jakub


Re: [Patch,AVR]: Solve PR42210

2011-04-26 Thread Richard Henderson
On 04/26/2011 04:51 AM, Georg-Johann Lay wrote:
> As the SFRs are volatile, insv expander skips
> them and a combine pattern must care of them. Omitting the complicated
> bit-plethora patterns I still see long, slow shift loops for HI. So
> the patch still includes them.

Why don't we focus on doing the right thing for plain registers first,
and worry about volatile SFRs second?

In particular, combine *should* be doing the right thing for registers,
putting those AND/OR/SHIFT whatsits back into insv/extv form, via
make_compound_operation.

> The snip "INTVAL(operands[...])" occurs more than 50 times in the
> machine description. Wouln't it be good to have an abbreviation like
> #define OPVAL(n) INTVAL(operands[n])) defined in, e.g. avr-protos.h?

No, what would be better is to define more predicates.  Though in the
case of comparing op2 vs op4, there's probably no helping it.

>> +(define_insn "*movbitqi_ext_reg"
>> +  [(set (zero_extract:QI
>> +  (match_operand:QI 0 "register_operand" "+*d,*d,r,r,r")
>> +  (const_int 1)
>> +  (match_operand 1 "const_0_to_7_operand" ""))
>> +(match_operand:QI 2 "nonme
> 
> Why do you use "*d" as constraint and not "d"?

Premature optimization.  But what it means is ignore "d" as a register
allocation class and only consider "r".

Why are you adding "optimize" to all these insns?  None of them will
be matched unless combine is run, which implies optimization.


r~


Re: [Patch,AVR]: Solve PR42210

2011-04-26 Thread Georg-Johann Lay
Richard Henderson schrieb:
> On 04/26/2011 04:51 AM, Georg-Johann Lay wrote:
>> As the SFRs are volatile, insv expander skips
>> them and a combine pattern must care of them. Omitting the complicated
>> bit-plethora patterns I still see long, slow shift loops for HI. So
>> the patch still includes them.
> 
> Why don't we focus on doing the right thing for plain registers first,
> and worry about volatile SFRs second?

The shift loops occur on registers. The insv now covers registers.
Besides that, in many places these operations are actually needed to
set SFR bits. I see combine try many insv for HImode; I don't know if
it is wise to support them without actually knowing what they are used
for. Most of this stuff will actually just use one byte of the values,
but that can't be seen at that point.

> In particular, combine *should* be doing the right thing for registers,
> putting those AND/OR/SHIFT whatsits back into insv/extv form, via
> make_compound_operation.

Yes it should. Bit combine only looks into thins up to some depth, and
intermediate patterns can help combine find the way. In the particular
case the combine bridges do no harm because they map to efficient
instruction sequences in all cases.

>> The snip "INTVAL(operands[...])" occurs more than 50 times in the
>> machine description. Wouln't it be good to have an abbreviation like
>> #define OPVAL(n) INTVAL(operands[n])) defined in, e.g. avr-protos.h?
> 
> No, what would be better is to define more predicates.  Though in the
> case of comparing op2 vs op4, there's probably no helping it.

Was just some a suggestion. I don't see how predicate would help in
switch (INTVAL(operands[n])) or similar places in all the C snipps...
The predicates you indicated are already included in the last patch.

> Why are you adding "optimize" to all these insns?  None of them will
> be matched unless combine is run, which implies optimization.

Similar pattern like *sbi, *cbi etc use that insn condition. I don't
know what the rationale behind that is/was, I just followed that.

Johann



Ping^3 Re: Target header etc. cleanup patch

2011-04-26 Thread Joseph S. Myers
Ping^3.  Parts of this patch 
 are still 
pending review: the parts for targets fr30, m32r, mn10300, rx, v850 
(target maintainers CC:ed).  This version applies cleanly to current 
trunk.

2011-04-26  Joseph Myers  

* config/fr30/fr30-protos.h (Mmode): Don't define.
* config/fr30/fr30.h (inhibit_libc): Don't define.
* config/m32r/m32r-protos.h (Mmode): Don't define.  Expand
definition where used.
* config/mn10300/mn10300-protos.h (Mmode, Cstar, Rclas): Don't
define.  Expand definitions where used.
* config/rx/rx-protos.h (Mmode, Fargs, Rcode): Don't define.
Expand definitions where used.
* config/rx/rx.c (rx_is_legitimate_address, rx_function_arg_size,
rx_function_arg, rx_function_arg_advance,
rx_function_arg_boundary): Expand definitions of those macros.
* config/v850/v850-protos.h (Mmode): Don't define.  Expand
definition where used.
* config/v850/v850.h (GHS_default_section_names,
GHS_current_section_names): Use tree, not union tree_node *.

Index: gcc/config/m32r/m32r-protos.h
===
--- gcc/config/m32r/m32r-protos.h   (revision 172860)
+++ gcc/config/m32r/m32r-protos.h   (working copy)
@@ -1,5 +1,6 @@
 /* Prototypes for m32r.c functions used in the md file & elsewhere.
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010,
+   2011
Free Software Foundation, Inc.
 
This file is part of GCC.
@@ -18,9 +19,8 @@
along with GCC; see the file COPYING3.  If not see
.  */
 
-/* Function prototypes that cannot exist in v850.h due to dependency
+/* Function prototypes that cannot exist in m32r.h due to dependency
complications.  */
-#define Mmode enum machine_mode
 
 extern void   m32r_init (void);
 extern void   m32r_init_expanders (void);
@@ -51,16 +51,14 @@ extern rtxm32r_return_addr (int);
 extern rtxm32r_function_symbol (const char *);
 
 #ifdef HAVE_MACHINE_MODES
-extern intcall_operand (rtx, Mmode);
-extern intsmall_data_operand (rtx, Mmode);
-extern intaddr24_operand (rtx, Mmode);
-extern intaddr32_operand (rtx, Mmode);
-extern intcall26_operand (rtx, Mmode);
-extern intmemreg_operand (rtx, Mmode);
-extern intsmall_insn_p (rtx, Mmode);
+extern intcall_operand (rtx, enum machine_mode);
+extern intsmall_data_operand (rtx, enum machine_mode);
+extern intaddr24_operand (rtx, enum machine_mode);
+extern intaddr32_operand (rtx, enum machine_mode);
+extern intcall26_operand (rtx, enum machine_mode);
+extern intmemreg_operand (rtx, enum machine_mode);
+extern intsmall_insn_p (rtx, enum machine_mode);
 
 #endif /* HAVE_MACHINE_MODES */
 
 #endif /* RTX_CODE */
-
-#undef  Mmode
Index: gcc/config/rx/rx-protos.h
===
--- gcc/config/rx/rx-protos.h   (revision 172860)
+++ gcc/config/rx/rx-protos.h   (working copy)
@@ -21,11 +21,6 @@
 #ifndef GCC_RX_PROTOS_H
 #define GCC_RX_PROTOS_H
 
-/* A few abbreviations to make the prototypes shorter.  */
-#define Mmode  enum machine_mode
-#define Fargs  CUMULATIVE_ARGS
-#define Rcode  enum rtx_code
-
 extern int rx_align_for_label (void);
 extern voidrx_expand_prologue (void);
 extern int rx_initial_elimination_offset (int, int);
@@ -37,11 +32,13 @@ extern void rx_emit_stack_pu
 extern voidrx_expand_epilogue (bool);
 extern char *  rx_gen_move_template (rtx *, bool);
 extern boolrx_legitimate_constant_p (enum machine_mode, rtx);
-extern boolrx_is_restricted_memory_address (rtx, Mmode);
-extern boolrx_match_ccmode (rtx, Mmode);
+extern boolrx_is_restricted_memory_address (rtx,
+enum machine_mode);
+extern boolrx_match_ccmode (rtx, enum machine_mode);
 extern voidrx_notice_update_cc (rtx body, rtx insn);
-extern voidrx_split_cbranch (Mmode, Rcode, rtx, rtx, rtx);
-extern Mmode   rx_select_cc_mode (Rcode, rtx, rtx);
+extern voidrx_split_cbranch (enum machine_mode, enum rtx_code,
+ rtx, rtx, rtx);
+extern enum machine_mode   rx_select_cc_mode (enum rtx_code, rtx, rtx);
 #endif
 
 #endif /* GCC_RX_PROTOS_H */
Index: gcc/config/rx/rx.c
===
--- gcc/config/rx/rx.c  (revision 172860)
+++ gcc/config/rx/rx.c  (working copy)
@@ -78,7 +78,8 @@ rx_small_data_operand (rtx op)
 }
 
 static bool
-rx_is_legitimate_address (Mmode mode, rtx x, bool strict ATTRIBUTE_UNUSED)
+rx_is_legitimate_address (enum machine_mode mode, rtx x,
+

Re: [build] Avoid ld -v error message with Sun ld on SPARC

2011-04-26 Thread Rainer Orth
David,

>> Thanks Rainer, if you cons up a patch to add the ".align" directive I'll ACK
>> that as well.
>
> here's the patch that I've been testing over the weekend.  It caused no
> change for HAVE_AS_SPARC_GOTDATA_OP on anything but Solaris 10 with gas
> and Sun ld, where HAVE_AS_SPARC_GOTDATA_OP is 1 now, and that
> configuration showed no testsuite regressions.
>
> Ok for mainline?

it's been a week since I've submitted this patch.  Or should I take it
as preapproved?

Thanks.
Rainer


> 2011-04-15  David S. Miller  
>   Rainer Orth  
>
>   * configure.ac (gcc_cv_as_sparc_gotdata_op): Specify alignment.
>   * configure: Regenerate.
>
> diff --git a/gcc/configure.ac b/gcc/configure.ac
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -3270,6 +3270,7 @@ case "$target" in
>gcc_cv_as_sparc_gotdata_op,,
>[-K PIC],
>  [.text
> +.align 4
>  foo:
>   nop
>  bar:

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [build, lto] Only accept -fuse-linker-plugin if linker supports -plugin (PR lto/46944)

2011-04-26 Thread Rainer Orth
Hi Ralf,

it's been a week since I answered your questions on this patch.  Could
you please have a look?

Thanks.
Rainer


>>> I haven't found if there are provisions for in-tree gold, though, and
>>> still cannot test that.
>>
>> I'm not quite sure I understand this statement.  I built a combined tree
>> with gold enabled a while ago (must've been several months now).
>> I might be misunderstanding this.
>
> I suppose I've been unclear: I'm specificially referring to the current
> code for setting gcc_cv_lto_plugin: in the in-tree case, there's nothing
> that deals with in-tree gold.
>
>>>if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" = 
>>> x"$gcc_cv_ld"; then
>>> -if test "$gcc_cv_gld_major_version" -eq 2 -a 
>>> "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2; 
>>> then
>>> -  gcc_cv_lto_plugin=2
>>> -elif test "$ld_is_gold" = yes -a "$gcc_cv_gld_major_version" -eq 2 -a 
>>> "$gcc_cv_gld_minor_version" -eq 20; then
>>> -  gcc_cv_lto_plugin=1
>>> -
>>> +ld_ver="GNU ld"
>>> +# FIXME: ld_is_gold?
>>
>> What about this FIXME?  Did you test gold?  Is it not relevant here?
>> Can the FIXME go?
>
> I cannot test gold since it doesn't yet work on Solaris: cf. binutils PR
> gold/12525.  We made some progress on that front, but the PR is
> currently stalled and I had other things on my plate that prevented me
> from pushing it.  As I said, the current code (before my patch) doesn't
> handle in-tree gold, so I don't feel obliged to change that, especially
> since I'm in no good position to test.
>
>>> +  ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
>>> +  ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
>>
>> Can you try the expr statements quickly on Tru64?  If not, I can do it
>> for you ('info Autoconf --index expr' is long and tells of many woes).
>
> I just tried with /bin/expr and ld_vers set to 2.20.1.  OTOH, this isn't
> relevant for two reasons: this code is identical to the one determining
> ld_vers_major/ld_vers_minor further up in gcc/configure.ac, and GNU ld
> (as well as GNU as) aren't currently supported on Tru64 UNIX and I
> seriously doubt that will change over the remaining livetime of the
> platform.
>
>> Thanks, and sorry for the delay,
>
> No worries.  I'd just like to get this series of patches out of my queue
> (and eventually backported to the 4.6 branch if all issues are sorted
> out).  Maybe one of the build maintainers finds some time to handle the
> current mess that are the linker tests in gcc/configure.ac, compared to
> what we do for the assembler.
>
> Thanks.
>   Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


iris6.h cleanup

2011-04-26 Thread Rainer Orth
I noticed a couple of cleanup opportunities in iris6.h:

* TARGET_NEWABI and TARGET_IRIX6 are always true in iris6.h.

* I'm avoiding an inline expansion of INT_TYPE_SIZE.

Bootstrapped without regressions on mips-sgi-irix6.5, installed on
mainline.

There may be more, though:

* Perhaps I can define _XOPEN_SOURCE=500 for C++ and remove
  __EXTENSIONS__, _SGI_SOURCE at the same time.  Given how sensitive
  target headers usually are to such changes, I'd like to keep such a
  patch separate.

* I'll have to check if libprof1.a exists anywhere, otherwise the specs
  can be simplified.

Rainer



diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h
--- a/gcc/config/mips/iris6.h
+++ b/gcc/config/mips/iris6.h
@@ -79,7 +79,7 @@ along with GCC; see the file COPYING3.  
   while (0)
 
 #undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX (TARGET_NEWABI ? "." : "$")
+#define LOCAL_LABEL_PREFIX "."
 
 #undef ASM_DECLARE_OBJECT_NAME
 #define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
@@ -106,7 +106,7 @@ along with GCC; see the file COPYING3.  
 #define WINT_TYPE (Pmode == DImode ? "int" : "long int")
 
 #undef WINT_TYPE_SIZE
-#define WINT_TYPE_SIZE 32
+#define WINT_TYPE_SIZE INT_TYPE_SIZE
 
 /* C99 stdint.h types.  */
 #define INT8_TYPE "signed char"
@@ -177,16 +177,15 @@ along with GCC; see the file COPYING3.  
   /* IRIX 6.5.18 and above provide many ISO C99\
 features protected by the __c99 macro. \
 libstdc++ v3 needs them as well.  */   \
-  if (TARGET_IRIX6)\
-   if (flag_isoc99 || c_dialect_cxx ())\
- builtin_define ("__c99"); \
+  if (flag_isoc99 || c_dialect_cxx ()) \
+   builtin_define ("__c99");   \
\
   /* The GNU C++ standard library requires that\
 __EXTENSIONS__ and _SGI_SOURCE be defined on at\
 least IRIX 6.2 and probably all IRIX 6 prior to 6.5.   \
 We don't need this on IRIX 6.5 itself, but it  \
 shouldn't hurt other than the namespace pollution.  */ \
-  if (!flag_iso || (TARGET_IRIX6 && c_dialect_cxx ())) \
+  if (!flag_iso || c_dialect_cxx ())   \
{   \
  builtin_define ("__EXTENSIONS__");\
  builtin_define ("_SGI_SOURCE");   \


-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: Ping^3 Re: Target header etc. cleanup patch

2011-04-26 Thread Nick Clifton

Hi Joseph,


2011-04-26  Joseph Myers

* config/fr30/fr30-protos.h (Mmode): Don't define.
* config/fr30/fr30.h (inhibit_libc): Don't define.
* config/m32r/m32r-protos.h (Mmode): Don't define.  Expand
definition where used.
* config/mn10300/mn10300-protos.h (Mmode, Cstar, Rclas): Don't
define.  Expand definitions where used.
* config/rx/rx-protos.h (Mmode, Fargs, Rcode): Don't define.
Expand definitions where used.
* config/rx/rx.c (rx_is_legitimate_address, rx_function_arg_size,
rx_function_arg, rx_function_arg_advance,
rx_function_arg_boundary): Expand definitions of those macros.
* config/v850/v850-protos.h (Mmode): Don't define.  Expand
definition where used.
* config/v850/v850.h (GHS_default_section_names,
GHS_current_section_names): Use tree, not union tree_node *.


I am not keen on the removal of the Mmode macro.  I think that having it 
makes the prototypes cleaner and easier to read.  I accept that it is 
silly for individual targets to define the macro on their own.  But in 
my opinion the "enum machine_mode" type deserves its own abbreviating 
definition like rtx or tree.


Similarly it would be nice to standard abbreviations for 
CUMULATIVE_ARGS, enum rtx_code, enum reg_class and const char *.  What 
do you think ?  I suspect that I am alone in this desire, in which case 
I will bow to public opinion and approve the whole patch.  But in the 
meantime I am happy with the other parts:




Index: gcc/config/m32r/m32r-protos.h
===



-/* Function prototypes that cannot exist in v850.h due to dependency
+/* Function prototypes that cannot exist in m32r.h due to dependency


Approved.



Index: gcc/config/fr30/fr30.h
===



-/* If cross-compiling, don't require stdio.h etc to build libgcc.a.  */
-#if defined CROSS_DIRECTORY_STRUCTURE&&  ! defined inhibit_libc
-#define inhibit_libc
-#endif
-


Approved.



Index: gcc/config/v850/v850.h
===



-extern union tree_node * GHS_default_section_names [(int) 
COUNT_OF_GHS_SECTION_KINDS];
-extern union tree_node * GHS_current_section_names [(int) 
COUNT_OF_GHS_SECTION_KINDS];
+extern tree GHS_default_section_names [(int) COUNT_OF_GHS_SECTION_KINDS];
+extern tree GHS_current_section_names [(int) COUNT_OF_GHS_SECTION_KINDS];


Approved.

Cheers
  Nick


Re: Ping^3 Re: Target header etc. cleanup patch

2011-04-26 Thread Joseph S. Myers
On Tue, 26 Apr 2011, Nick Clifton wrote:

> Similarly it would be nice to standard abbreviations for CUMULATIVE_ARGS, enum
> rtx_code, enum reg_class and const char *.  What do you think ?  I suspect

I think defining an abbreviation for const char * is actively bad, since 
const char * is a standard C idiom as-is and inventing local names for 
something with a standard C name should be avoided unless you are 
genuinely adding GCC-specific semantics.  (Yes, HOST_WIDEST_INT ought to 
be replaced by intmax_t/uintmax_t.)

My position on CUMULATIVE_ARGS remains that this type should become 
private to each back end and not visible in any code outside of config/ - 
with dynamic conversions from a target-independent type being used by the 
affected hooks.  (See PR 46500.)  Once the type is private to the back 
ends, they can also use a name other than CUMULATIVE_ARGS if they wish - 
but a typedef rather than a #define, please.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [doc] Remove references to mips-tfile on MIPS

2011-04-26 Thread Rainer Orth
Joseph,

> Not strictly related to this patch, but there are other cleanups possible 
> because of the only-used-on-Tru64 nature of mips-tdump/mips-tfile.  In 
> particular, there are seven target macros (all undocumented) used by those 
> programs and nowhere else in GCC: ALIGN_SYMTABLE_OFFSET CODE_MASK 
> MIPS_IS_STAB MIPS_MARK_STAB MIPS_UNMARK_STAB SHASH_SIZE THASH_SIZE.  
> Since those are only defined in alpha.h and only used on those programs, 
> it would be better to hardcode the definitions inside 
> mips-{tdump,tfile}.c, remove them from alpha.h and so eliminate seven 
> target macros (about 1% of the total).  If you also hardcode the right 
> definition of MIPS_DEBUGGING_INFO (used both in mips-tfile and elsewhere) 
> then these programs should no longer depend on target macros and their 
> tm.h includes can be removed.

seems like a plan.  I'll have a look, especially since several of the
macros are only used in either mips-tfile.c or mips-tdump.c, so such a
patch wouldn't introduce much duplication.

> (There are many other instances of #if conditionals in those programs, all 
> of which are suspect since the programs are native-only for a single 
> target and so shouldn't need conditional compilation at all.  But those 
> other conditionals aren't relevant to target macro elimination.)

I strongly suspect this occured when the MIPS port no longer needed
mips-tfile, but didn't remove MIPS dependencies.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [debug] PR42288 emit empty .debug_aranges section

2011-04-26 Thread Rainer Orth
Hi Mark,

> Thanks for testing the patch. Although I am slightly confused how it
> ended up producing a .debug_abbrev section that is actually empty. Are
> you sure this isn't an existing issue?

it certainly is, and not related to your patch (which I didn't test: my
IRIX and Tru64 UNIX boxes are far too slow to test anything not
immediatly related ;-)  I just observed this general issue and wanted to
point it out to avoid introducing other instances without due
consideration.

> The only thing the patch should do (and seems to do on my GNU/Linux
> setup) is to explicitly output a .debug_aranges section that is of the
> minimum size (so not actually empty, just indicating no ranges are
> covered by outputting just the table terminator).

Seems I misread the patch then: I'd suspect this (instead of zero-sized
sections) should be safe.  Sorry for the noise.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [build] Avoid ld -v error message with Sun ld on SPARC

2011-04-26 Thread Paolo Bonzini

On 04/26/2011 05:25 PM, Rainer Orth wrote:

David,


Thanks Rainer, if you cons up a patch to add the ".align" directive I'll ACK
that as well.


here's the patch that I've been testing over the weekend.  It caused no
change for HAVE_AS_SPARC_GOTDATA_OP on anything but Solaris 10 with gas
and Sun ld, where HAVE_AS_SPARC_GOTDATA_OP is 1 now, and that
configuration showed no testsuite regressions.

Ok for mainline?


it's been a week since I've submitted this patch.  Or should I take it
as preapproved?

Thanks.
 Rainer



2011-04-15  David S. Miller
Rainer Orth

* configure.ac (gcc_cv_as_sparc_gotdata_op): Specify alignment.
* configure: Regenerate.

diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3270,6 +3270,7 @@ case "$target" in
gcc_cv_as_sparc_gotdata_op,,
[-K PIC],
  [.text
+.align 4
  foo:
nop
  bar:




I was waiting for David or Eric to approve it since I know nothing about 
this stuff. :)


Paolo


Re: Ping^2 Re: Target header etc. cleanup patch

2011-04-26 Thread Christopher Faylor
On Thu, Apr 21, 2011 at 11:56:52PM -0400, Jie Zhang wrote:
>On 04/21/2011 06:06 AM, Joseph S. Myers wrote:
>> On Thu, 21 Apr 2011, Richard Guenther wrote:
>>
>>> On Wed, Apr 20, 2011 at 11:09 PM, Joseph S. Myers
>>>   wrote:
 Ping^2.  This patch
   is still pending
 review.  This version applies cleanly to current trunk.
>>>
>>> The s/struct rtx_def */rtx/ changes are all ok (in fact I'd say they are
>>> obvious).
>>
>> I have committed the approved parts (those, plus the cris and m32c
>> changes) as r172818.  The following remains pending review (target
>> maintainers CC:ed).
>>
>> 2011-04-21  Joseph Myers
>>
>>  * config/bfin/bfin-protos.h (Mmode): Don't define.  Expand
>>  definition where used.
>
>OK for bfin. Thanks!

Don't know if you've heard from anyone else yet but, in case not: ok for 
Windows.


Re: [PATCH,Fortran] Handle 'q' exponent-letter in real-literal-constant

2011-04-26 Thread Steve Kargl
On Mon, Apr 25, 2011 at 11:15:35PM +0300, Janne Blomqvist wrote:
> On Mon, Apr 25, 2011 at 22:45, Steve Kargl
>  wrote:
> > On Mon, Apr 25, 2011 at 10:26:20PM +0300, Janne Blomqvist wrote:
> >> Hmm, I'd prefer if the warning was issued only with -Wsomething which
> >> would be included in -Wall. But I suppose this can be done as a
> >> follow-up patch.
> >
> > I thought about adding a -freal-q-constant option.
> 
> -Wreal-q-constant, presumably?
> 

Yes.  I've implemented in the revised patch, and I've
updated the docs.

2011-04-26  Steven G. Kargl  

PR fortran/48720
* gfortran.texi: Document the 'Q' exponent-letter extension.
* invoke.texi: Document -Wreal-q-constant.
* lang.opt: Add -Wreal-q-constant option.
* gfortran.h: Add warn_real_q_constant to option struct.
* primary.c (match_real_constant):  Use it.  Accept 'Q' as
exponent-letter for REAL(16) real-literal-constant with a
fallback to REAL(10) or error if REAL(10) is not available.
* options.c (gfc_init_options, set_Wall) Set it.
(gfc_handle_option): Handle new option.

OK?

-- 
Steve
Index: gfortran.texi
===
--- gfortran.texi	(revision 172974)
+++ gfortran.texi	(working copy)
@@ -1237,6 +1237,7 @@ without warning.
 * Missing period in FORMAT specifications::
 * I/O item lists::
 * BOZ literal constants::
+* @code{Q} exponent-letter::
 * Real array indices::
 * Unary operators::
 * Implicitly convert LOGICAL and INTEGER values::
@@ -1427,6 +1428,18 @@ To support legacy codes, GNU Fortran all
 of the @code{READ} statement, and the output item lists of the
 @code{WRITE} and @code{PRINT} statements, to start with a comma.
 
+@node @code{Q} exponent-letter
+@subsection @code{Q} exponent-letter
+@cindex @code{Q} exponent-letter
+
+GNU Fortran accepts real literal constants with an exponent-letter
+of @code{Q}, for example, @code{1.23Q45}.  The constant is interpreted
+as a @code{REAL(16)} entity on targets that suppports this type.  If
+the target does not support @code{REAL(16)} but has a @code{REAL(10)}
+type, then the real-literal-constant will be interpreted as a
+@code{REAL(10)} entity.  In the absence of @code{REAL(16)} and
+@code{REAL(10)}, an error will occur.
+
 @node BOZ literal constants
 @subsection BOZ literal constants
 @cindex BOZ literal constants
Index: gfortran.h
===
--- gfortran.h	(revision 172974)
+++ gfortran.h	(working copy)
@@ -2189,6 +2189,7 @@ typedef struct
   int warn_character_truncation;
   int warn_array_temp;
   int warn_align_commons;
+  int warn_real_q_constant;
   int warn_unused_dummy_argument;
   int max_errors;
 
Index: lang.opt
===
--- lang.opt	(revision 172974)
+++ lang.opt	(working copy)
@@ -242,6 +242,10 @@ Wintrinsics-std
 Fortran Warning
 Warn on intrinsics not part of the selected standard
 
+Wreal-q-constant
+Fortran Warning
+Warn about real-literal-constants with 'q' exponent-letter
+
 Wreturn-type
 Fortran Warning
 ; Documented in C
Index: invoke.texi
===
--- invoke.texi	(revision 172974)
+++ invoke.texi	(working copy)
@@ -134,12 +134,13 @@ by type.  Explanations are in the follow
 @item Error and Warning Options
 @xref{Error and Warning Options,,Options to request or suppress errors
 and warnings}.
-@gccoptlist{-fmax-errors=@var{n} @gol
--fsyntax-only  -pedantic  -pedantic-errors @gol
--Wall  -Waliasing  -Wampersand  -Warray-bounds -Wcharacter-truncation @gol
--Wconversion -Wimplicit-interface  -Wimplicit-procedure  -Wline-truncation @gol
--Wintrinsics-std  -Wsurprising  -Wno-tabs  -Wunderflow  -Wunused-parameter @gol
--Wintrinsic-shadow  -Wno-align-commons -Wfunction-elimination}
+@gccoptlist{-fmax-errors=@var{n}
+-fsyntax-only -pedantic -pedantic-errors -Wall @gol
+-Waliasing -Wampersand -Warray-bounds -Wcharacter-truncation @gol
+-Wconversion -Wimplicit-interface -Wimplicit-procedure -Wline-truncation @gol
+-Wintrinsics-std -Wreal-q-format -Wsurprising -Wno-tabs -Wunderflow @gol
+-Wunused-parameter -Wintrinsic-shadow -Wno-align-commons @gol
+-Wfunction-elimination}
 
 @item Debugging Options
 @xref{Debugging Options,,Options for debugging your program or GNU Fortran}.
@@ -694,7 +695,7 @@ we recommend avoiding and that we believ
 This currently includes @option{-Waliasing}, @option{-Wampersand}, 
 @option{-Wconversion}, @option{-Wsurprising}, @option{-Wintrinsics-std},
 @option{-Wno-tabs}, @option{-Wintrinsic-shadow}, @option{-Wline-truncation},
-and @option{-Wunused}.
+@option{-Wreal-q-format} and @option{-Wunused}.
 
 @item -Waliasing
 @opindex @code{Waliasing}
@@ -782,6 +783,12 @@ it as @code{EXTERNAL} procedure because 
 be used to never trigger this behavior and always link to the intrinsic
 regardless of the selected standard.
 
+@item -Wreal-q-constant
+@opindex @cod

Re: [PATCH,Fortran] Handle 'q' exponent-letter in real-literal-constant

2011-04-26 Thread Janne Blomqvist
On Tue, Apr 26, 2011 at 19:52, Steve Kargl
 wrote:
> Yes.  I've implemented in the revised patch, and I've
> updated the docs.
>
> 2011-04-26  Steven G. Kargl  
>
>        PR fortran/48720
>        * gfortran.texi: Document the 'Q' exponent-letter extension.
>        * invoke.texi: Document -Wreal-q-constant.
>        * lang.opt: Add -Wreal-q-constant option.
>        * gfortran.h: Add warn_real_q_constant to option struct.
>        * primary.c (match_real_constant):  Use it.  Accept 'Q' as
>        exponent-letter for REAL(16) real-literal-constant with a
>        fallback to REAL(10) or error if REAL(10) is not available.
>        * options.c (gfc_init_options, set_Wall) Set it.
>        (gfc_handle_option): Handle new option.

--- primary.c   (revision 172974)
+++ primary.c   (working copy)
@@ -616,6 +627,29 @@ done:
   kind = gfc_default_double_kind;
   break;

+case 'q':
+  if (kind != -2)
+   {
+ gfc_error ("Real number at %C has a 'q' exponent and an explicit "
+"kind");
+ goto cleanup;
+   }
+
+  /* The maximum possible real kind type parameter is 16.  First, try
+that for the kind, then fallback to trying kind=10 (Intel 80 bit)
+extended precision.  If neither value works, just given up.  */

s/given/give/

> OK?

Ok. Thanks for fixing this!

-- 
Janne Blomqvist


Put inliners info about cgraph edges into its own summary structure

2011-04-26 Thread Jan Hubicka
Hi,
this patch moves inliner related callgraph edge info
(call_stmt_size/time and loop_nest) into inliner own edge summaries,
just like we have for ipa-prop.

Primary motivation for doing so is that I don't want to add edge predicates
to main cgraph edge and handle them in lto-cgraph, but doing this change
also turned out to be quite nice cleanup. In particular the loop nest
handling was quite spread across the compiler. Now all updating happens
at one spot in ipa-inline-analysis.

The patch also fixes several bugs with loop nest updating: we never updated
loop nests of indirect edges when inlining and also some code assumed that no
nest is 0, other 1. This lead to underflows in the nest counter.

The patch also adds more human readable dump of inline decisions than
the callgraph with inlined_to pointers.

Bootstrapped/regtested x86_64-linux, will commit it later today.

Honza

* cgraphbuild.c (build_cgraph_edges): Update call
of cgraph_create_edge and cgraph_create_indirect_edge.
* cgraph.c (cgraph_create_edge_including_clones,
cgraph_create_edge_1, cgraph_allocate_init_indirect_info,
cgraph_update_edges_for_call_stmt_node): Do not take nest
argument; do not initialize call_stmt_size/time.
(dump_cgraph_node): Do not dump nest.
(cgraph_clone_edge): Do not take loop_nest argument;
do not propagate it; do not clone call_stmt_size/time.
(cgraph_clone_node): Likewise.
(cgraph_create_virtual_clone): Update.
* cgraph.h (struct cgraph_edge): Remove
call_stmt_size/call_stmt_time/loop_nest.
(cgraph_create_edge, cgraph_create_indirect_edge,
cgraph_create_edge_including_clones, cgraph_clone_node): Update
prototype.
* tree-emutls.c (gen_emutls_addr): Update.
* ipa-inline-transform.c (update_noncloned_frequencies): Do not handle
loop_nest; handle indirect calls, too.
(clone_inlined_nodes): Do not care about updating inline summaries.
* cgraphunit.c (cgraph_copy_node_for_versioning): Update.
* lto-cgraph.c (lto_output_edge, input_node, input_edge): Do not
stream call_stmt_size/call_stmt_time/loop_nest.
* ipa-inline.c (edge_badness): Update.
(ipa_inline): dump summaries after inlining.
* ipa-inline.h (struct inline_edge_summary, inline_edge_summary_t):
new.
(inline_edge_summary): New function.
* ipa-inline-analysis.c (edge_duplication_hook_holder): New holder.
(inline_edge_removal_hook): Handle edge summaries.
(inline_edge_duplication_hook): New hook.
(inline_summary_alloc): Alloc hooks.
(initialize_growth_caches): Do not register removal hooks.
(free_growth_caches); Do not free removal hook.
(dump_inline_edge_summary): New function.
(dump_inline_summary): Use it.
(estimate_function_body_sizes, estimate_edge_size_and_time): Update.
(inline_update_callee_summaries): New function.
(inline_merge_summary): Use it.
(do_estimate_edge_time, do_estimate_edge_growth): Update.
(read_inline_edge_summary): New function.
(inline_read_section): Use it.
(write_inline_edge_summary): New function.
(inline_write_summary): Use it.
(inline_free_summary): Free edge new holders.
* tree-inline.c (copy_bb): Update.
Index: cgraphbuild.c
===
*** cgraphbuild.c   (revision 172962)
--- cgraphbuild.c   (working copy)
*** build_cgraph_edges (void)
*** 354,365 
  decl = gimple_call_fndecl (stmt);
  if (decl)
cgraph_create_edge (node, cgraph_get_create_node (decl),
!   stmt, bb->count, freq, bb->loop_depth);
  else
cgraph_create_indirect_edge (node, stmt,
 gimple_call_flags (stmt),
!bb->count, freq,
!bb->loop_depth);
}
  walk_stmt_load_store_addr_ops (stmt, node, mark_load,
 mark_store, mark_address);
--- 354,364 
  decl = gimple_call_fndecl (stmt);
  if (decl)
cgraph_create_edge (node, cgraph_get_create_node (decl),
!   stmt, bb->count, freq);
  else
cgraph_create_indirect_edge (node, stmt,
 gimple_call_flags (stmt),
!bb->count, freq);
}
  walk_stmt_load_store_addr_ops (stmt, node, mark_load,
 mark_store, mark_address);
*** rebuild_cgraph_edges (void)
*** 464,475 
  decl = gimple_call_fndecl (stmt);
  if (decl)
cgrap

[C PATCH] Avoid nested C_MAYBE_CONST_EXPR in build_binary_op (PR c/48742)

2011-04-26 Thread Jakub Jelinek
Hi!

As discussed in the PR, build_binary_op was calling c_wrap_maybe_const
which added one C_MAYBE_CONST_EXPR to GT_EXPR operand, then the whole
GT_EXPR has been enclosed into another C_MAYBE_CONST_EXPR because
int_operands has been true.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux.
Ok for 4.6/trunk?

2011-04-26  Jakub Jelinek  

PR c/48742
* c-typeck.c (build_binary_op): Don't wrap arguments if
int_operands is true.

* gcc.c-torture/compile/pr48742.c: New test.

--- gcc/c-typeck.c.jj   2011-04-12 09:37:56.0 +0200
+++ gcc/c-typeck.c  2011-04-26 17:10:35.0 +0200
@@ -10190,7 +10190,7 @@ build_binary_op (location_t location, en
warn_for_sign_compare (location, orig_op0_folded,
   orig_op1_folded, op0, op1,
   result_type, resultcode);
- if (!in_late_binary_op)
+ if (!in_late_binary_op && !int_operands)
{
  if (!op0_maybe_const || TREE_CODE (op0) != INTEGER_CST)
op0 = c_wrap_maybe_const (op0, !op0_maybe_const);
--- gcc/testsuite/gcc.c-torture/compile/pr48742.c.jj2011-04-26 
17:13:12.0 +0200
+++ gcc/testsuite/gcc.c-torture/compile/pr48742.c   2011-04-26 
17:12:41.0 +0200
@@ -0,0 +1,15 @@
+/* PR c/48742 */
+
+void baz (int);
+
+int
+foo (void)
+{
+  return 1 / 0 > 0;
+}
+
+void
+bar (void)
+{
+  baz (1 <= 2 % (3 >> 1 > 5 / 6 == 3));
+}

Jakub


Re: [PATCH, C++] Remove unused cp_fold_obj_type_ref

2011-04-26 Thread Rainer Orth
Martin,

> last year I removed the last use of cp_fold_obj_type_ref (which was a
> language hook) but forgot to remove the function itself.  So I'm about
> to do it now.
>
> I'm currently bootstrapping and testing the following patch.  I
> consider it obvious enough to commit it myself on Tuesday if it
> passes.

the patch was so obvious that it broke bootstrap:

/vol/gcc/src/hg/trunk/local/gcc/objc/objc-act.c: In function 
'objc_fold_obj_type_ref':
/vol/gcc/src/hg/trunk/local/gcc/objc/objc-act.c:8625:3: error: implicit 
declaration of function 'cp_fold_obj_type_ref' 
[-Werror=implicit-function-declaration]
/vol/gcc/src/hg/trunk/local/gcc/objc/objc-act.c:8625:3: error: return makes 
pointer from integer without a cast [-Werror]
cc1: all warnings being treated as errors

make[3]: *** [objcp/objcp-act.o] Error 1

grep is your friend.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH, 4.7] Add float/double vector reductions to VSX

2011-04-26 Thread Michael Meissner
On Sat, Apr 23, 2011 at 04:11:50PM -0400, David Edelsohn wrote:
> Except the patch includes a change to pattern vsx_xxpermdi_ that
> is not explained nor mentioned in the ChangeLog.

Yes, that vsx_xxpermdi_ patch was wrong.  I believe that snuck in because
I had done the work on an older tree before Alan Modra's change on 3/16 that
modified vsx_xxpermdi_.  I have committed the change.

-- 
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meiss...@linux.vnet.ibm.com fax +1 (978) 399-6899


Re: [build] Avoid ld -v error message with Sun ld on SPARC

2011-04-26 Thread David Miller
From: Rainer Orth 
Date: Tue, 26 Apr 2011 17:25:56 +0200

> David,
> 
>>> Thanks Rainer, if you cons up a patch to add the ".align" directive I'll ACK
>>> that as well.
>>
>> here's the patch that I've been testing over the weekend.  It caused no
>> change for HAVE_AS_SPARC_GOTDATA_OP on anything but Solaris 10 with gas
>> and Sun ld, where HAVE_AS_SPARC_GOTDATA_OP is 1 now, and that
>> configuration showed no testsuite regressions.
>>
>> Ok for mainline?
> 
> it's been a week since I've submitted this patch.  Or should I take it
> as preapproved?
> 

I'm sorry about this, I must have missed it inadvertantly.

ACK to this patch, thanks for your contributions.


Re: [patch, fortran] Put front-end temporaries into BLOCKs

2011-04-26 Thread Thomas Koenig

Hi Jerry,




OK and thanks for patch.


Waiting for Emacs...
Sende  ChangeLog
Sende  frontend-passes.c
Übertrage Daten ..
Revision 172983 übertragen.

Thanks for the review!

Thomas


C++ PATCH for c++/48530 (hard errors with deleted destructors)

2011-04-26 Thread Jason Merrill
Daniel Krugler has been doing well at ferreting out parts of the 
compiler that haven't been properly SFINAE'd yet...


Tested x86_64-pc-linux-gnu, applied to trunk.
commit 93016efbbb141f1bd917c4032b4a94b2b4c85516
Author: Jason Merrill 
Date:   Mon Apr 25 20:07:15 2011 -0400

PR c++/48530
* decl.c (cxx_maybe_build_cleanup): Add complain parm.
* tree.c (force_target_expr): Add complain parm.
(build_target_expr_with_type): Likewise.
(get_target_expr_sfinae): Split out.
(build_vec_init_expr, bot_manip): Adjust.
* init.c (build_vec_delete, build_vec_delete_1): Add complain parm.
(build_delete, build_dtor_call): Likewise.
(perform_direct_initialization_if_possible): Adjust.
(build_vec_init): Handle error return.
* cvt.c (force_rvalue): Add complain parm.
Call build_special_member_call directly.
* decl2.c (delete_sanity): Add complain parm.
(build_cleanup): Adjust.
* pt.c (tsubst_copy_and_build, tsubst_expr): Adjust.
* semantics.c (finish_stmt_expr_expr): Adjust.
(finish_compound_literal): Adjust.
* parser.c (cp_parser_delete_expression): Adjust.
* typeck2.c (build_functional_cast): Adjust.
* cp-tree.h: Adjust.

diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index cf8e1a5..10efd1c 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4144,7 +4144,11 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
  && TREE_CODE (arg3) != THROW_EXPR)
{
  if (!VOID_TYPE_P (arg3_type))
-   arg3 = force_rvalue (arg3);
+   {
+ arg3 = force_rvalue (arg3, complain);
+ if (arg3 == error_mark_node)
+   return error_mark_node;
+   }
  arg3_type = TREE_TYPE (arg3);
  result_type = arg3_type;
}
@@ -4152,7 +4156,11 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
   && TREE_CODE (arg3) == THROW_EXPR)
{
  if (!VOID_TYPE_P (arg2_type))
-   arg2 = force_rvalue (arg2);
+   {
+ arg2 = force_rvalue (arg2, complain);
+ if (arg2 == error_mark_node)
+   return error_mark_node;
+   }
  arg2_type = TREE_TYPE (arg2);
  result_type = arg2_type;
}
@@ -4359,11 +4367,11 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
  that isn't wrapped with a TARGET_EXPR plays havoc with exception
  regions.  */
 
-  arg2 = force_rvalue (arg2);
+  arg2 = force_rvalue (arg2, complain);
   if (!CLASS_TYPE_P (arg2_type))
 arg2_type = TREE_TYPE (arg2);
 
-  arg3 = force_rvalue (arg3);
+  arg3 = force_rvalue (arg3, complain);
   if (!CLASS_TYPE_P (arg3_type))
 arg3_type = TREE_TYPE (arg3);
 
@@ -5642,7 +5650,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, 
int argnum,
expr = convert_bitfield_to_declared_type (expr);
expr = fold_convert (type, expr);
  }
-   expr = build_target_expr_with_type (expr, type);
+   expr = build_target_expr_with_type (expr, type, complain);
  }
 
/* Take the address of the thing to which we will bind the
@@ -6341,7 +6349,7 @@ build_over_call (struct z_candidate *cand, int flags, 
tsubst_flags_t complain)
  if (TREE_CODE (arg) == TARGET_EXPR)
return arg;
  else if (trivial)
-   return force_target_expr (DECL_CONTEXT (fn), arg);
+   return force_target_expr (DECL_CONTEXT (fn), arg, complain);
}
   else if (TREE_CODE (arg) == TARGET_EXPR || trivial)
{
@@ -8246,7 +8254,7 @@ set_up_extended_ref_temp (tree decl, tree expr, tree 
*cleanup, tree *initp)
   if (TREE_STATIC (var))
init = add_stmt_to_compound (init, register_dtor_fn (var));
   else
-   *cleanup = cxx_maybe_build_cleanup (var);
+   *cleanup = cxx_maybe_build_cleanup (var, tf_warning_or_error);
 
   /* We must be careful to destroy the temporary only
 after its initialization has taken place.  If the
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 66ac4e8..228e33c 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4740,7 +4740,7 @@ extern void adjust_clone_args (tree);
 /* in cvt.c */
 extern tree convert_to_reference   (tree, tree, int, int, tree);
 extern tree convert_from_reference (tree);
-extern tree force_rvalue   (tree);
+extern tree force_rvalue   (tree, tsubst_flags_t);
 extern tree ocp_convert(tree, tree, int, int);
 extern tree cp_convert (tree, tree);
 extern tree cp_convert_and_check(tree, tree);
@@ -4854,7 +4854,7 @@ extern tree next_initializable_field (tree);
 extern bool defer_mark_used_calls;
 extern GTY(()) VEC(tree, gc) *deferred_mark_used_calls;
 extern tree finish_case_label  (location_t, t

Re: [C PATCH] Avoid nested C_MAYBE_CONST_EXPR in build_binary_op (PR c/48742)

2011-04-26 Thread Joseph S. Myers
On Tue, 26 Apr 2011, Jakub Jelinek wrote:

> 2011-04-26  Jakub Jelinek  
> 
>   PR c/48742
>   * c-typeck.c (build_binary_op): Don't wrap arguments if
>   int_operands is true.
> 
>   * gcc.c-torture/compile/pr48742.c: New test.

OK.

-- 
Joseph S. Myers
jos...@codesourcery.com


New mirror in Phoenix, US (was: new mirror in Nicosia, Cyprus)

2011-04-26 Thread Gerald Pfeifer
On Mon, 25 Apr 2011, Gerald Pfeifer wrote:
> Grigory and me mailed off-list a bit, and I just applied the patch
> below (after checking the mirror now seems to be fully active).
> 
> Just one question: is this server _really_ located in Cyprus?  My
> traceroutes seem to indicate otherwise.

It turns out I failed to actually commit the patch, which is cool since 
there is an updated one after some more research.  Thanks, Grigory!

This one I _did_ commit. ;-)

Gerald

Index: mirrors.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/mirrors.html,v
retrieving revision 1.208
diff -u -r1.208 mirrors.html
--- mirrors.html10 Apr 2011 10:41:39 -  1.208
+++ mirrors.html26 Apr 2011 20:07:52 -
@@ -51,6 +51,7 @@
 Slovakia, Bratislava: http://gcc.fyxm.net/";>gcc.fyxm.net, 
thanks to Jan Teluch (admin at 2600 dot sk)
 UK: ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/";>ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/,
 thanks to mirror at mirrorservice dot org
 UK, London: http://gcc-uk.internet.bs";>http://gcc-uk.internet.bs, thanks to 
Internet.bs (info at internet dot bs)
+US, Phoenix: http://fileboar.com/gcc/";>fileboar.com, thanks 
to Grigory Rayskin (rayskin73 at gmail dot com)
 US, Tampa: http://mirrors-us.seosue.com/gcc/";>http://mirrors-us.seosue.com/gcc/, 
thanks to Peter Vrzak (petervrzak at gmail dot com)
 Viet Nam, HoChiMinh: http://mirror-fpt-telecom.fpt.net/gcc/";>http://mirror-fpt-telecom.fpt.net/gcc/,
 thanks to Minh Vu Tong (mirror at fpt dot net)
 


Re: [PATCH, C++] Remove unused cp_fold_obj_type_ref

2011-04-26 Thread Jason Merrill

On 04/26/2011 02:07 PM, Rainer Orth wrote:

the patch was so obvious that it broke bootstrap:


I'm applying this patch to fix bootstrap.

commit 922f4a593d65ab65025b0af7b59bb9513d394aac
Author: jason 
Date:   Tue Apr 26 21:12:57 2011 +

* objc-act.c (objc_fold_objc_type_ref): Remove.
* objc-act.h: Remove prototype.

diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 0b6b793..250b317 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -8602,33 +8602,6 @@ objc_type_valid_for_messaging (tree type, bool 
accept_classes)
   return false;
 }
 
-/* Fold an OBJ_TYPE_REF expression for ObjC method dispatches, where
-   this occurs.  ObjC method dispatches are _not_ like C++ virtual
-   member function dispatches, and we account for the difference here.  */
-tree
-#ifdef OBJCPLUS
-objc_fold_obj_type_ref (tree ref, tree known_type)
-#else
-objc_fold_obj_type_ref (tree ref ATTRIBUTE_UNUSED,
-   tree known_type ATTRIBUTE_UNUSED)
-#endif
-{
-#ifdef OBJCPLUS
-  tree v = BINFO_VIRTUALS (TYPE_BINFO (known_type));
-
-  /* If the receiver does not have virtual member functions, there
- is nothing we can (or need to) do here.  */
-  if (!v)
-return NULL_TREE;
-
-  /* Let C++ handle C++ virtual functions.  */
-  return cp_fold_obj_type_ref (ref, known_type);
-#else
-  /* For plain ObjC, we currently do not need to do anything.  */
-  return NULL_TREE;
-#endif
-}
-
 void
 objc_start_function (tree name, tree type, tree attrs,
 #ifdef OBJCPLUS
diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h
index 909181a..d604299 100644
--- a/gcc/objc/objc-act.h
+++ b/gcc/objc/objc-act.h
@@ -26,7 +26,6 @@ along with GCC; see the file COPYING3.  If not see
 
 bool objc_init (void);
 const char *objc_printable_name (tree, int);
-tree objc_fold_obj_type_ref (tree, tree);
 int objc_gimplify_expr (tree *, gimple_seq *, gimple_seq *);
 void objc_common_init_ts (void);
 


Re: [patch, fortran] Make block names unique

2011-04-26 Thread Mikael Morin
On Tuesday 26 April 2011 00:40:40 Thomas Koenig wrote:
> Am 22.04.2011 22:07, schrieb Thomas Koenig:
> > Hello world,
> > 
> > the attached patch makes block names unique, so that
> > -fdump-fortran-original dumps are easier to read.
> > 
> > Regression-tested. OK for trunk?
> > 
> > Thomas
> > 
> > 2011-04-22 Thomas Koenig 
> > 
> > * decl.c (gfc_match_end): Check that the block name starts
> > with "block@".
> > * parse.c (gfc_build_block_ns): Make block names unique by
> > numbering them.
> 
> Ping ** 0.25?
> 
>   Thomas
OK



[Patch, Fortran] PRs 48112/48279 - fix interface related regressions

2011-04-26 Thread Tobias Burnus

This patch fixes three issues, (a) and (b) are 4.6/4.7 regressions.

a) PR48112: Due to incomplete resolution, there was an ICE when writing 
the module file. Solution: Back-out the patch which introduced the 
incomplete resolution - and add a similar patch later to avoid printing 
errors multiple times.


b) PR48279: The patch adding supporting functions calls as actual 
argument to intent-in dummies had problems with generics, which lead to 
an ICE. Solution: Use the expr's specific procedure (esym) instead.


c) PR48279 comment 8: gfortran was accepting internal procedures in 
INTERFACE; solution: Reject it with -std=f2008, but accept it with 
-std=gnu. Reasoning: Except of NAG all other tested compilers also 
accept it.


Build and currently regtesting on x86-64.
OK for the trunk - and for 4.6?

Tobias

PS: Besides those two, there are three other regressions:
1. PR 48462: -frealloc-lhs issue, partially fixed by Paul; follow-up 
patch pending - and then 4.6 backporting.
2. PR 45586: ICE (tree checking) with LTO, seems to be a restricted vs. 
not decl issue.

3. PR 42954: The target CPP issue ...
As (1) and (2) are 4.6/4.7 regressions, we should really concentrate on 
fixing them before the 4.6.1 release.
2011-04-26  Tobias Burnus  

	PR fortran/48112
	* resolve.c (resolve_fl_var_and_proc): Print diagnostic of
	function results only once.
	(resolve_symbol): Always resolve function results.

	PR fortran/48279
	* expr.c (gfc_check_vardef_context): Fix handling of generic
	EXPR_FUNCTION.
	* interface.c (check_interface0): Reject internal functions
	in generic interfaces, unless -std=gnu.

2011-04-26  Tobias Burnus  

	PR fortran/48112
	PR fortran/48279
	* gfortran.dg/interface_35.f90: New.
	* gfortran.dg/erfc_scaled_1.f90: Don't compile with -pedantic.
	* gfortran.dg/func_result_6.f90: Add dg-warning.
	* gfortran.dg/bessel_1.f90: Ditto.
	* gfortran.dg/hypot_1.f90: Ditto.
	* gfortran.dg/proc_ptr_comp_20.f90: Ditto.
	* gfortran.dg/proc_ptr_comp_21.f90: Ditto.
	* gfortran.dg/interface_assignment_4.f90: Ditto.

diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index dae2149..3d519db 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -4371,15 +4371,26 @@ gfc_build_intrinsic_call (const char* name, locus where, unsigned numarg, ...)
 gfc_try
 gfc_check_vardef_context (gfc_expr* e, bool pointer, const char* context)
 {
-  gfc_symbol* sym;
+  gfc_symbol* sym = NULL;
   bool is_pointer;
   bool check_intentin;
   bool ptr_component;
   symbol_attribute attr;
   gfc_ref* ref;
 
+  if (e->expr_type == EXPR_VARIABLE)
+{
+  gcc_assert (e->symtree);
+  sym = e->symtree->n.sym;
+}
+  else if (e->expr_type == EXPR_FUNCTION)
+{
+  gcc_assert (e->symtree);
+  sym = e->value.function.esym ? e->value.function.esym : e->symtree->n.sym;
+}
+
   if (!pointer && e->expr_type == EXPR_FUNCTION
-  && e->symtree->n.sym->result->attr.pointer)
+  && sym->result->attr.pointer)
 {
   if (!(gfc_option.allow_std & GFC_STD_F2008))
 	{
@@ -4397,9 +4408,6 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, const char* context)
   return FAILURE;
 }
 
-  gcc_assert (e->symtree);
-  sym = e->symtree->n.sym;
-
   if (!pointer && sym->attr.flavor == FL_PARAMETER)
 {
   if (context)
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 5e7a1dc..1f75724 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1128,6 +1128,12 @@ check_interface0 (gfc_interface *p, const char *interface_name)
 		 " or all FUNCTIONs", interface_name, &p->sym->declared_at);
 	  return 1;
 	}
+
+  if (p->sym->attr.proc == PROC_INTERNAL
+	  && gfc_notify_std (GFC_STD_GNU, "Extension: Internal procedure '%s' "
+			 "in %s at %L", p->sym->name, interface_name,
+			 &p->sym->declared_at) == FAILURE)
+	return 1;
 }
   p = psave;
 
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index d7b95f5..59a863c 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -9886,6 +9886,11 @@ apply_default_init_local (gfc_symbol *sym)
 static gfc_try
 resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag)
 {
+  /* Avoid double diagnostics for function result symbols.  */
+  if ((sym->result || sym->attr.result) && !sym->attr.dummy
+  && (sym->ns != gfc_current_ns))
+return SUCCESS;
+
   /* Constraints on deferred shape variable.  */
   if (sym->as == NULL || sym->as->type != AS_DEFERRED)
 {
@@ -11974,11 +11979,6 @@ resolve_symbol (gfc_symbol *sym)
   gfc_namespace *ns;
   gfc_component *c;
 
-  /* Avoid double resolution of function result symbols.  */
-  if ((sym->result || sym->attr.result) && !sym->attr.dummy
-  && (sym->ns != gfc_current_ns))
-return;
-  
   if (sym->attr.flavor == FL_UNKNOWN)
 {
 

--- /dev/null	2011-04-21 07:44:25.943893902 +0200
+++ gcc/gcc/testsuite/gfortran.dg/interface_35.f90	2011-04-26 22:41:18.0 +0200
@@ -0,0 +1,79 @@
+! { dg-do compile }
+! { dg-options "-std=f2008" }
+!
+! PR fortra

Re: [build, lto] Only accept -fuse-linker-plugin if linker supports -plugin (PR lto/46944)

2011-04-26 Thread Ralf Wildenhues
Hello Rainer,

* Rainer Orth wrote on Tue, Apr 26, 2011 at 05:28:19PM CEST:
> it's been a week since I answered your questions on this patch.  Could
> you please have a look?

Sorry for the delay.  I'm practically AFK until the weekend or maybe
next weekend, whenever I have connectivity again after relocating;
if another build maintainer could take a look that would be nice,
otherwise I will get to it ASAP.

Thanks,
Ralf

> >>> I haven't found if there are provisions for in-tree gold, though, and
> >>> still cannot test that.
> >>
> >> I'm not quite sure I understand this statement.  I built a combined tree
> >> with gold enabled a while ago (must've been several months now).
> >> I might be misunderstanding this.
> >
> > I suppose I've been unclear: I'm specificially referring to the current
> > code for setting gcc_cv_lto_plugin: in the in-tree case, there's nothing
> > that deals with in-tree gold.
> >
> >>>if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" = 
> >>> x"$gcc_cv_ld"; then
> >>> -if test "$gcc_cv_gld_major_version" -eq 2 -a 
> >>> "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2; 
> >>> then
> >>> -  gcc_cv_lto_plugin=2
> >>> -elif test "$ld_is_gold" = yes -a "$gcc_cv_gld_major_version" -eq 2 
> >>> -a "$gcc_cv_gld_minor_version" -eq 20; then
> >>> -  gcc_cv_lto_plugin=1
> >>> -
> >>> +ld_ver="GNU ld"
> >>> +# FIXME: ld_is_gold?
> >>
> >> What about this FIXME?  Did you test gold?  Is it not relevant here?
> >> Can the FIXME go?
> >
> > I cannot test gold since it doesn't yet work on Solaris: cf. binutils PR
> > gold/12525.  We made some progress on that front, but the PR is
> > currently stalled and I had other things on my plate that prevented me
> > from pushing it.  As I said, the current code (before my patch) doesn't
> > handle in-tree gold, so I don't feel obliged to change that, especially
> > since I'm in no good position to test.
> >
> >>> +  ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
> >>> +  ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
> >>
> >> Can you try the expr statements quickly on Tru64?  If not, I can do it
> >> for you ('info Autoconf --index expr' is long and tells of many woes).
> >
> > I just tried with /bin/expr and ld_vers set to 2.20.1.  OTOH, this isn't
> > relevant for two reasons: this code is identical to the one determining
> > ld_vers_major/ld_vers_minor further up in gcc/configure.ac, and GNU ld
> > (as well as GNU as) aren't currently supported on Tru64 UNIX and I
> > seriously doubt that will change over the remaining livetime of the
> > platform.
> >
> >> Thanks, and sorry for the delay,
> >
> > No worries.  I'd just like to get this series of patches out of my queue
> > (and eventually backported to the 4.6 branch if all issues are sorted
> > out).  Maybe one of the build maintainers finds some time to handle the
> > current mess that are the linker tests in gcc/configure.ac, compared to
> > what we do for the assembler.


Re: Improve DSE in the presence of calls

2011-04-26 Thread Easwaran Raman
On Mon, Apr 25, 2011 at 10:03 AM, Jeff Law  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 04/22/11 14:19, Easwaran Raman wrote:
>> Hi,
>>  This patch improves RTL DSE by not assuming that calls read all
>> memory locations. With this patch, calls are assumed to read any
>> non-frame memory and any stack variables that can potentially escape.
>> This patch partly addresses PR rtl-optimization/44194. Bootstraps and
>> no test regressions. OK for trunk?
>>
>> Thanks,
>> Easwaran
>>
>> 2011-04-22  Easwaran Raman  
>>
>> PR rtl-optimization/44194
>>       * dse.c (header files): Include tree-flow.h.
>>       (group_info): Add fields.
>>       (globals): Add a new variable kill_on_calls.
>>       (get_group_info): Initialize added fields.
>>       (dse_step0): Initialize kill_on_calls.
>>       (can_escape): New function.
>>       (record_store): Pass EXPR corresponding to MEM to
>>       set_usage_bits.
>>       (dse_step2_nospill): Set kill_on_calls based on
>>       group->escaped_*.
>>       (scan_reads_nospill): Handle call instructions.
>>       (find_insn_before_first_wild_read): Remove the function.
>>       (dse_step3_scan): Remove call to find_insn_before_first_wild_read.
>>       (dse_step5_nospill): Do not kill everything on call.
>>
>> testsuite/ChangeLog:
>>
>> 2011-04-22  Easwaran Raman  
>>
>> PR rtl-optimization/44194
>>       * gcc.dg/pr44194-1.c: New test.
> On a bookkeeping note, it doesn't appear that you ever release the
> bitmaps for gi->escaped_{p,n} or kill_on_calls.  This should probably be
> done in dse_step7.
I've now freed the bitmaps in dse_step7.

> I'm going to assume that you and Richi have agreed upon the form of
> can_escape.

Yes, Richard suggested to use may_be_aliased for now to check for escaping.

> AFAICT, even after your patch we still have a wild read recorded for
> most CALL_INSNs (see this code in scan_insn which was not modified):
>
>
>
>
>      else
>        /* Every other call, including pure functions, may read memory.  */
>        add_wild_read (bb_info);
>
> It appears that you effectively ignore the wild_read in
> scan_reads_nospill by special casing CALL_INSNs.  Correct?  Is so, does
> it make still sense to call add_wild_read in scan_insn?
>
>
> ISTM that wild reads are still possible due to a few other constructs
> such as asms, address canonicalization failure, etc, so why is the
> removal of the wild read support in dse_step5_nospill correct?

You're right. The patch has correctness issues. It is not possible to
simply not call add_wild_read because it also resets
active_local_stores and frees read_recs. During the local phase it
seems better to just treat calls as wild reads and reset
active_local_stores and free read_recs. I've now refactored
add_wild_read so that resetting active_local_stores and free read_recs
are in separate methods that can be called on non-const/non-memset
calls. In addition, I have added a non_frame_wild_read field in
insn_info to mark non-const and non-memset calls.

I've attached the revised patch.

-Easwaran

> Just to be clear, I generally like the change, but there's some details
> that I think need to be better understood before installing.
>
> jeff
>
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJNtalUAAoJEBRtltQi2kC7evMH/0UyasIBTcZM7MSeCDGvefdR
> byd5/XaaH1FtdRS64ne1bGbjB/h96AJbXYfc3QECtKugfmwgSbJeaN/BD8T4WY/L
> 2z1MkeSwcpswnxufjTR6G5WezuUsxagB4/xoSqk7NRfJdsM3eBR9n+ehTwlfsU5q
> bTvQ/Uat0x027ddyrifD6vIOIIqFwMba9CvvN7vV0O+yzuxjzxNfe4IEcyMg2RIZ
> j6xK+Bv7pge9pHC8ERKOFO17CPdK2JBe4ovtFL8s1sadBkjO2044uRszcl8E/9rj
> MUGHExtFEIypzzi0wBqWyy3fz5QRCBuN/Xj6ptk4Cw7dkuBTZPWjySWrXV5kEs4=
> =omzC
> -END PGP SIGNATURE-
>

2011-04-26  Easwaran Raman  

* dse.c: Include tree-flow.h
(insn_info): Add new field non_frame_wild_read.
(group_info): Add new fields escaped_n and escaped_p.
(kill_on_calls): New variable.
(get_group_info): Initialize gi->escaped_n and gi->escaped_p.
(dse_step0): Initialize kill_on_calls.
(can_escape): New function.
(set_usage_bits): Add additional parameter; record information
about escaped locations.
(record_store): Pass EXPR corresponding to MEM to
set_usage_bits.
(dse_step2_nospill): Set kill_on_calls based on
group->escaped_n and group->escaped_n.
(add_wild_read): Refactor into...
(reset_active_stores): ... New method, and
(free_read_records): ... New method.
(add_non_frame_wild_read): New method.
(scan_insn): Call add_non_frame_wild_read on non-const calls.
(scan_reads_nospill): Handle instructions with
non_frame_wild_read.
(dse_step5_nospill): Call scan_reads_nospill for instructions
marked as non_frame_wild_read.
(dse_step7): Free escaped_n, escaped_p and kill_on_calls
bitmaps.

testsuite/Cha

Re: [patch, fortran] Make block names unique

2011-04-26 Thread Thomas Koenig

Hi Mikael,



* decl.c (gfc_match_end): Check that the block name starts
with "block@".
* parse.c (gfc_build_block_ns): Make block names unique by
numbering them.


Ping ** 0.25?

Thomas

OK



Waiting for Emacs...
Sendingfortran/ChangeLog
Sendingfortran/decl.c
Sendingfortran/parse.c
Transmitting file data ...
Committed revision 172990.

Thanks for the review!

Thomas



Re: [PATCH,Fortran] Handle 'q' exponent-letter in real-literal-constant

2011-04-26 Thread Mikael Morin
On Tuesday 26 April 2011 18:52:58 Steve Kargl wrote:
> On Mon, Apr 25, 2011 at 11:15:35PM +0300, Janne Blomqvist wrote:
> > On Mon, Apr 25, 2011 at 22:45, Steve Kargl
> > 
> >  wrote:
> > > On Mon, Apr 25, 2011 at 10:26:20PM +0300, Janne Blomqvist wrote:
> > >> Hmm, I'd prefer if the warning was issued only with -Wsomething which
> > >> would be included in -Wall. But I suppose this can be done as a
> > >> follow-up patch.
> > > 
> > > I thought about adding a -freal-q-constant option.
> > 
> > -Wreal-q-constant, presumably?
> 
> Yes.  I've implemented in the revised patch, and I've
> updated the docs.
> 
> 2011-04-26  Steven G. Kargl  
> 
>   PR fortran/48720
>   * gfortran.texi: Document the 'Q' exponent-letter extension.
>   * invoke.texi: Document -Wreal-q-constant.
>   * lang.opt: Add -Wreal-q-constant option.
>   * gfortran.h: Add warn_real_q_constant to option struct.
>   * primary.c (match_real_constant):  Use it.  Accept 'Q' as
>   exponent-letter for REAL(16) real-literal-constant with a
>   fallback to REAL(10) or error if REAL(10) is not available.
>   * options.c (gfc_init_options, set_Wall) Set it.
>   (gfc_handle_option): Handle new option.
> 
> OK?
Sorry to jump late on this.


> Index: primary.c
> ===
> --- primary.c   (revision 172974)
> +++ primary.c   (working copy)
> @@ -541,6 +541,17 @@ match_real_constant (gfc_expr **result, 
>  goto done;
>exp_char = c;
>  
> +
> +  if (c == 'q')
> +{
> +  if (gfc_notify_std (GFC_STD_GNU, "Extension: exponent-letter 'q' in "
> +"real-literal-constant at %C") == FAILURE)
> +   return MATCH_ERROR;
> +  else if (gfc_option.warn_real_q_constant)
> +   gfc_warning("Extension: exponent-letter 'q' in real-literal-constant 
"
> +   "at %C");
> +}
I think the above could generate double warnings. With -pedantic for example 
(but I didn't check). 
By the way testcases are missing :-p.

> @@ -616,6 +627,29 @@ done:
>kind = gfc_default_double_kind;
>break;
>  
> +case 'q':
> +  if (kind != -2)
> +   {
> + gfc_error ("Real number at %C has a 'q' exponent and an explicit "
> +"kind");
> + goto cleanup;
> +   }
> +
> +  /* The maximum possible real kind type parameter is 16.  First, try
> +that for the kind, then fallback to trying kind=10 (Intel 80 bit)
> +extended precision.  If neither value works, just given up.  */
> +  kind = 16;
> +  if (gfc_validate_kind (BT_REAL, kind, true) < 0)
> +   {
> + kind = 10;
> +  if (gfc_validate_kind (BT_REAL, kind, true) < 0)
> +   {
> + gfc_error ("Invalid real kind %d at %C", kind);
> + goto cleanup;
> +   }
Here kind is guaranteed to be 10 in the error. As the user didn't specify 
kind=10 explicitely, I suggest a more informative message like (for example):
Use of 'q' exponent requires REAL(16) or REAL(10) support at %C

I only glanced at the rest, but Jane OK'ed it anyway :-).

Mikael



[PATCH Commitred] Fix PR target/48767

2011-04-26 Thread Kaz Kojima
Hi,

The attached target specific patch is to fix PR target/48767.
In the problematic case, sh.c:sh_gimplify_va_arg_expr calls
targetm.calls.must_pass_in_stack with void type as its 2nd
argument which is unexpected by the callee.  The patch is
tested on sh4-unknown-linux-gnu with no new failures.
Applied on trunk.

Regards,
kaz
--
2011-04-26  Kaz Kojima  

PR target/48767
* config/sh/sh.c (sh_gimplify_va_arg_expr): Don't call
targetm.calls.must_pass_in_stack for void type.

--- ORIG/trunk/gcc/config/sh/sh.c   2011-04-23 09:43:19.0 +0900
+++ trunk/gcc/config/sh/sh.c2011-04-26 10:40:25.0 +0900
@@ -8062,9 +8062,14 @@ sh_gimplify_va_arg_expr (tree valist, tr
   HOST_WIDE_INT size, rsize;
   tree tmp, pptr_type_node;
   tree addr, lab_over = NULL, result = NULL;
-  int pass_by_ref = targetm.calls.must_pass_in_stack (TYPE_MODE (type), type);
+  bool pass_by_ref;
   tree eff_type;
 
+  if (!VOID_TYPE_P (type))
+pass_by_ref = targetm.calls.must_pass_in_stack (TYPE_MODE (type), type);
+  else
+pass_by_ref = false;
+
   if (pass_by_ref)
 type = build_pointer_type (type);
 


Re: Don't use linux.h for non-Linux targets

2011-04-26 Thread Thomas Schwinge
Hallo!

First, Joseph, thanks for working on this clean-up!  I'm sorry for the
delay, but I have now reviewed all these patches (including those you
have committed by now); looks all good.


On Tue, 12 Apr 2011 18:37:50 + (UTC), "Joseph S. Myers" 
 wrote:
> This patch stops targets not using the Linux kernel from using
> linux*.h config headers.  [...]

> 2011-04-12  Joseph Myers  
> 
>   * config.gcc (*-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* |
>   *-*-kopensolaris*-gnu): Don't define SINGLE_LIBC.
>   (i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu |
>   i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu,
>   x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu): Don't use
>   linux*.h headers.
>   * config/gnu-user.h (TARGET_C99_FUNCTIONS, TARGET_HAS_SINCOS):
>   Define.
>   * config/i386/gnu.h (MD_UNWIND_SUPPORT): Don't undefine.
>   * config/i386/kfreebsd-gnu.h (MD_UNWIND_SUPPORT): Don't undefine.
>   * config/i386/knetbsd-gnu.h (MD_UNWIND_SUPPORT): Don't undefine.
>   * config/i386/kopensolaris-gnu.h (MD_UNWIND_SUPPORT): Don't
>   undefine.
>   * config/i386/linux-unwind.h (x86_fallback_frame_state): Don't use
>   REG_NAME.
>   * config/i386/linux.h (REG_NAME): Don't define.
>   * config/i386/linux64.h (REG_NAME): Don't define.
>   * config/linux.h (TARGET_C99_FUNCTIONS, TARGET_HAS_SINCOS):
>   Undefine before defining.

Looks good, too.  I have not yet built-tested this (and it's too late by
now), but I'll do that in the next days.


One (minor) additional idea: for clarity, shouldn't it now be possible to
remove any #undef GNU_USER_TARGET_OS_CPP_BUILTINS, #undef
GNU_USER_DYNAMIC_LINKER, #undef GNU_USER_LINK_EMULATION, etc. from
*gnu.h?  I don't expect you to test this; I'll have a look later on.

I'll also test whether gnu.h:LIB_SPEC is still needed, or if the
gnu-user.h definition contains all we need.


Grüße,
 Thomas


pgpUo74PLWe9F.pgp
Description: PGP signature


Re: [PATCH Commitred] Fix PR target/48767

2011-04-26 Thread Joseph S. Myers
I think you should add a testcase to gcc.c-torture/compile, unless there 
is already one that this patch fixes.

-- 
Joseph S. Myers
jos...@codesourcery.com


PATCH: PR rtl-optimization/48575: RTL vector patterns are limited to 26 elements

2011-04-26 Thread H.J. Lu
On Mon, Apr 4, 2011 at 6:05 PM, H.J. Lu  wrote:
> On Thu, Mar 31, 2011 at 5:05 AM, Kenneth Zadeck
>  wrote:
>> we hit this limit trying to write the explicit semantics for a
>> vec_interleave_evenv32qi.
>>
>> ;;(define_insn "vec_interleave_evenv32qi"
>> ;;  [(set (match_operand:V32QI 0 "register_operand" "=r")
>> ;;    (vec_select:V32QI
>> ;;      (vec_concat:V64QI
>> ;;        (match_operand:V32QI 1 "register_operand" "0")
>> ;;        (match_operand:V32QI 2 "register_operand" "r"))
>> ;;      (parallel [(const_int  0) (const_int 32)
>> ;;             (const_int  2) (const_int 34)
>> ;;             (const_int  4) (const_int 36)
>> ;;             (const_int  6) (const_int 38)
>> ;;             (const_int  8) (const_int 40)
>> ;;             (const_int 10) (const_int 42)
>> ;;             (const_int 12) (const_int 44)
>> ;;             (const_int 14) (const_int 46)
>> ;;             (const_int 16) (const_int 48)
>> ;;             (const_int 18) (const_int 50)
>> ;;             (const_int 20) (const_int 52)
>> ;;             (const_int 22) (const_int 54)
>> ;;             (const_int 24) (const_int 56)
>> ;;             (const_int 26) (const_int 58)
>> ;;             (const_int 28) (const_int 60)
>> ;;             (const_int 30) (const_int 62)])))]
>> ;;  ""
>> ;;  "rimihv\t%0,%2,8,15,8"
>> ;;  [(set_attr "type" "rimi")])
>>
>>
>> kenny
>>
>> On 03/31/2011 06:16 AM, Mike Stump wrote:
>>>
>>> On Mar 31, 2011, at 1:41 AM, Richard Guenther wrote:

 On Wed, Mar 30, 2011 at 8:09 PM, H.J. Lu  wrote:
>
> On Wed, Mar 30, 2011 at 08:02:38AM -0700, H.J. Lu wrote:
>>
>> Hi,
>>
>> Currently, we limit XVECEXP to 26 elements in machine description
>> since we use letters 'a' to 'z' to encode them.  I don't see any
>> reason why we can't go beyond 'z'.  This patch removes this
>> restriction.
>> Any comments?
>>
> That was wrong.  The problem is in vector elements.  This patch passes
> bootstrap.  Any comments?

 Do you really need it?
>>>
>>> I'm trying to recall if this is the limit Kenny and I hit  If so,
>>> annoying.  Kenny could confirm if it was.  gcc's general strategy of, no
>>> fixed N gives gcc a certain flexibility that is very nice to have, on those
>>> general grounds, I kinda liked this patch.
>>
>
> Is my patch OK to install?
>

Here is my patch:

http://gcc.gnu.org/ml/gcc-patches/2011-03/msg02105.html

OK for trunk?

Thanks.


-- 
H.J.


[patch] Add new -gmlt option for min. debug info with line tables (issue4440072)

2011-04-26 Thread Cary Coutant
This patch adds a new option, -gmlt, that produces level 1 debug info
plus line number tables and inlined subroutine information. (The option
is short for "minimum line tables," taken from a similar feature of
HP's compilers.)

We've been using this option at Google for about a year now, and have
found it useful for collecting stack traces with file names and line
numbers without having to pay the much larger overhead for full debug
info. It's also useful for sample-based profiling, as discriminator
information is also available in the line number tables.

For optimized code, we've measured binaries built with -g0, -gmlt,
and -g2, and found that the total size of a binary compiled with -gmlt
is about 2.5x larger than one compiled without debug, while a binary
compiled with -g2 is about 6.7x larger. 

OK for trunk?

-cary


M   gcc/common.opt
M   gcc/doc/invoke.texi
M   gcc/dwarf2out.c
M   gcc/opts.c
A   gcc/testsuite/gcc.dg/debug/dwarf2/mlt1.c
A   gcc/testsuite/gcc.dg/debug/dwarf2/mlt2.c
M   gcc/tree-ssa-live.c

Tested:
  bootstrapped on x86_64.
  Added two new test cases.

gcc/ChangeLog:

* common.opt (generate_debug_line_table): New global var.
(gmlt): New option
* dwarf2out.c (GENERATE_MINIMUM_LINE_TABLE): New macro.
(add_pubname_string): Test for -gmlt.
(add_pubname): Likewise.
(add_src_coords_attributes): Likewise.
(decls_for_scope): Likewise.
(dwarf2out_source_line): Likewise.
(dwarf2out_finish): Likewise.
* opts.c (finish_options): Force debug info to at least level 1
if -gmlt specified.
(common_handle_option): Add OPT_gmlt.
(set_debug_level): Set generate_debug_line_table flag.
* tree-ssa-live.c (remove_unused_scope_block_p): Test for -gmlt.

* doc/invoke.texi (-gmlt): New options

gcc/testsuite/ChangeLog:

* gcc.dg/debug/dwarf2/mlt1.c: New test.
* gcc.dg/debug/dwarf2/mlt2.c: New test.

diff --git a/gcc/common.opt b/gcc/common.opt
index 83a61fc..2964d61 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -120,6 +120,11 @@ enum debug_info_type write_symbols = NO_DEBUG
 Variable
 enum debug_info_levels debug_info_level = DINFO_LEVEL_NONE
 
+; Whether to generate line number table.  Normally set at DINFO_LEVEL_NORMAL
+; or above; can also be set for DINFO_LEVEL_TERSE with -gmlt.
+Variable
+bool generate_debug_line_table = false
+
 ; Nonzero means use GNU-only extensions in the generated symbolic
 ; debugging information.  Currently, this only has an effect when
 ; write_symbols is set to DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG.
@@ -2150,6 +2155,10 @@ ggdb
 Common JoinedOrMissing
 Generate debug information in default extended format
 
+gmlt
+Common RejectNegative
+Generate debug information at level 1 with minimal line table
+
 gstabs
 Common JoinedOrMissing Negative(gstabs+)
 Generate debug information in STABS format
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 4377f34..b199253 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -320,7 +320,7 @@ Objective-C and Objective-C++ Dialects}.
 -fstack-usage  -ftest-coverage  -ftime-report -fvar-tracking @gol
 -fvar-tracking-assignments  -fvar-tracking-assignments-toggle @gol
 -g  -g@var{level}  -gtoggle  -gcoff  -gdwarf-@var{version} @gol
--ggdb  -gstabs  -gstabs+  -gstrict-dwarf  -gno-strict-dwarf @gol
+-ggdb  -gmlt  -gstabs  -gstabs+  -gstrict-dwarf  -gno-strict-dwarf @gol
 -gvms  -gxcoff  -gxcoff+ @gol
 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
 -fdebug-prefix-map=@var{old}=@var{new} @gol
@@ -4679,6 +4679,11 @@ debug format is long obsolete, but the option cannot be 
changed now.
 Instead use an additional @option{-g@var{level}} option to change the
 debug level for DWARF.
 
+@item -gmlt
+@opindex gmlt
+Produce a minimal line table, with level 1 debugging information plus
+information about inlined functions and line numbers.
+
 @item -gtoggle
 @opindex gtoggle
 Turn off generation of debug info, if leaving out this option would have
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index f3c4c09..4506f7f 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -113,6 +113,10 @@ int vms_file_stats_name (const char *, long long *, long 
*, char *, int *);
 #define DWARF2_INDIRECT_STRING_SUPPORT_MISSING_ON_TARGET 0
 #endif
 
+/* True if generating only the minimum line table (-gmlt).  */
+#define GENERATE_MINIMUM_LINE_TABLE (debug_info_level == DINFO_LEVEL_TERSE \
+&& generate_debug_line_table)
+
 /* ??? Poison these here until it can be done generically.  They've been
totally replaced in this file; make sure it stays that way.  */
 #undef DWARF2_UNWIND_INFO
@@ -11639,7 +11643,7 @@ dwarf2_name (tree decl, int scope)
 static void
 add_pubname_string (const char *str, dw_die_ref die)
 {
-  if (targetm.want_debug_pub_sections)
+  if (!GENERATE_MINIMUM_LINE_TABLE && targetm.want_debug_pub_sections)
 {
   pubname_entry e;
 
@

Re: [patch] Add new -gmlt option for min. debug info with line tables (issue4440072)

2011-04-26 Thread Andrew Pinski
On Tue, Apr 26, 2011 at 3:44 PM, Cary Coutant  wrote:
> This patch adds a new option, -gmlt, that produces level 1 debug info
> plus line number tables and inlined subroutine information. (The option
> is short for "minimum line tables," taken from a similar feature of
> HP's compilers.)

What is the difference between -gmlt and -g1?  And why can't this just
be enabled for -g1?

Thanks,
Andrew Pinski


Re: [patch] Add new -gmlt option for min. debug info with line tables (issue4440072)

2011-04-26 Thread Cary Coutant
>> This patch adds a new option, -gmlt, that produces level 1 debug info
>> plus line number tables and inlined subroutine information. (The option
>> is short for "minimum line tables," taken from a similar feature of
>> HP's compilers.)
>
> What is the difference between -gmlt and -g1?  And why can't this just
> be enabled for -g1?

With -g1, you don't get line number tables or any inlined subroutine
information. Here's the description of -g1 in the docs:

"Level 1 produces minimal information, enough for making backtraces in
parts of the program that you don't plan to debug.  This includes
descriptions of functions and external variables, but no information
about local variables and no line numbers."

I considered just changing -g1 to do this, with the argument that
"enough for making backtraces" ought to include line numbers and
inlined function calls, but I wasn't familiar enough with existing
uses of -g1 to go with that alternative. I'm certainly willing to go
that route, though, if that's preferable.

If we do go with extending -g1, though. we want to be able to turn it
on in our build scripts, yet allow a later "-g" option in the user's
compiler options to enable full debug info. In this patch, I've made
sure that "-gmlt -g" is equivalent to "-g2", whereas "-g1 -g" is the
same as "-g1" by itself. (It's too much to train people to use "-g2"
instead of "-g" when they want full debug.)

-cary


Re: [patch] Add new -gmlt option for min. debug info with line tables (issue4440072)

2011-04-26 Thread Andrew Pinski
On Tue, Apr 26, 2011 at 3:57 PM, Cary Coutant  wrote:
> If we do go with extending -g1, though. we want to be able to turn it
> on in our build scripts, yet allow a later "-g" option in the user's
> compiler options to enable full debug info. In this patch, I've made
> sure that "-gmlt -g" is equivalent to "-g2", whereas "-g1 -g" is the
> same as "-g1" by itself. (It's too much to train people to use "-g2"
> instead of "-g" when they want full debug.)
>

Well I think -g1 -g should act like how -O2 -O works.  That is should be -g2.

Thanks,
Andrew Pinski


Re: [PATCH Commitred] Fix PR target/48767

2011-04-26 Thread Kaz Kojima
"Joseph S. Myers"  wrote:
> I think you should add a testcase to gcc.c-torture/compile, unless there 
> is already one that this patch fixes.

Ah, indeed.  How about the attached testcase?
BTW, is it valid C?

Regards,
kaz
--
--- ORIG/trunk/gcc/testsuite/gcc.c-torture/compile/pr48767.c1970-01-01 
09:00:00.0 +0900
+++ trunk/gcc/testsuite/gcc.c-torture/compile/pr48767.c 2011-04-27 
07:54:05.0 +0900
@@ -0,0 +1,9 @@
+/* PR target/48767 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+foo (__builtin_va_list ap)
+{
+  __builtin_va_arg (ap, void);
+}




Re: [PATCH,Fortran] Handle 'q' exponent-letter in real-literal-constant

2011-04-26 Thread Steve Kargl
On Wed, Apr 27, 2011 at 12:23:03AM +0200, Mikael Morin wrote:
> On Tuesday 26 April 2011 18:52:58 Steve Kargl wrote:
> > On Mon, Apr 25, 2011 at 11:15:35PM +0300, Janne Blomqvist wrote:
> > > On Mon, Apr 25, 2011 at 22:45, Steve Kargl
> > > 
> > >  wrote:
> > > > On Mon, Apr 25, 2011 at 10:26:20PM +0300, Janne Blomqvist wrote:
> > > >> Hmm, I'd prefer if the warning was issued only with -Wsomething which
> > > >> would be included in -Wall. But I suppose this can be done as a
> > > >> follow-up patch.
> > > > 
> > > > I thought about adding a -freal-q-constant option.
> > > 
> > > -Wreal-q-constant, presumably?
> > 
> > Yes.  I've implemented in the revised patch, and I've
> > updated the docs.
> > 
> > 2011-04-26  Steven G. Kargl  
> > 
> > PR fortran/48720
> > * gfortran.texi: Document the 'Q' exponent-letter extension.
> > * invoke.texi: Document -Wreal-q-constant.
> > * lang.opt: Add -Wreal-q-constant option.
> > * gfortran.h: Add warn_real_q_constant to option struct.
> > * primary.c (match_real_constant):  Use it.  Accept 'Q' as
> > exponent-letter for REAL(16) real-literal-constant with a
> > fallback to REAL(10) or error if REAL(10) is not available.
> > * options.c (gfc_init_options, set_Wall) Set it.
> > (gfc_handle_option): Handle new option.
> > 
> > OK?
> Sorry to jump late on this.
> 

No problem.  I would rather get it right than rush something
into the tree.

> > Index: primary.c
> > ===
> > --- primary.c   (revision 172974)
> > +++ primary.c   (working copy)
> > @@ -541,6 +541,17 @@ match_real_constant (gfc_expr **result, 
> >  goto done;
> >exp_char = c;
> >  
> > +
> > +  if (c == 'q')
> > +{
> > +  if (gfc_notify_std (GFC_STD_GNU, "Extension: exponent-letter 'q' in "
> > +"real-literal-constant at %C") == FAILURE)
> > +   return MATCH_ERROR;
> > +  else if (gfc_option.warn_real_q_constant)
> > +   gfc_warning("Extension: exponent-letter 'q' in 
> > real-literal-constant 
> "
> > +   "at %C");
> > +}
> I think the above could generate double warnings. With -pedantic for example 
> (but I didn't check). 

It's an 'if -- else if' construct.  If gfc_notify_std == FAILURE, then
the error message is issues and the function returns.   If it is TRUE,
then there should be no messages and else if() is tested.

laptop:kargl[204] gfc4x -pedantic -o z ui.f90
ui.f90:3.12:

   q = 1.23q45
1
Warning: Extension: exponent-letter 'q' in real-literal-constant at (1)
laptop:kargl[205] gfc4x -pedantic -o z -std=f95 ui.f90
ui.f90:3.12:

   q = 1.23q45
1
Error: Extension: exponent-letter 'q' in real-literal-constant at (1)

> By the way testcases are missing :-p.

I haven't figure out how to write the testcases (yet).  :-)

> > @@ -616,6 +627,29 @@ done:
> >kind = gfc_default_double_kind;
> >break;
> >  
> > +case 'q':
> > +  if (kind != -2)
> > +   {
> > + gfc_error ("Real number at %C has a 'q' exponent and an explicit "
> > +"kind");
> > + goto cleanup;
> > +   }
> > +
> > +  /* The maximum possible real kind type parameter is 16.  First, try
> > +that for the kind, then fallback to trying kind=10 (Intel 80 bit)
> > +extended precision.  If neither value works, just given up.  */
> > +  kind = 16;
> > +  if (gfc_validate_kind (BT_REAL, kind, true) < 0)
> > +   {
> > + kind = 10;
> > +  if (gfc_validate_kind (BT_REAL, kind, true) < 0)
> > +   {
> > + gfc_error ("Invalid real kind %d at %C", kind);
> > + goto cleanup;
> > +   }
> Here kind is guaranteed to be 10 in the error. As the user didn't specify 
> kind=10 explicitely, I suggest a more informative message like (for example):
> Use of 'q' exponent requires REAL(16) or REAL(10) support at %C

Good catch!  I'll update the error message based on your suggestion.

-- 
Steve


Re: [patch] Add new -gmlt option for min. debug info with line tables (issue4440072)

2011-04-26 Thread Cary Coutant
> Well I think -g1 -g should act like how -O2 -O works.  That is should be -g2.

I think so, too, but I guess I was too timid to assume such a change
might be acceptable. If the maintainers would go along with that, I'd
have no problem revising the patch to make -g1 do line tables and
inline info. (I guess I'd have to add -gmlt as an alias for -g1 on the
google/main branch for compatibility, though -- not that that's a big
deal.)

-cary


[pph] Mark C++ codes with proper TS_* type markers (issue4436059)

2011-04-26 Thread Diego Novillo

We were failing to save several fields in C++ specific tree codes
because they were not properly marked with TS_* tree structure tags.
For instance, we were not streaming EXPR_STMTs because they were not
recognized as TS_EXPs in the streamer, so its arguments were never
saved.

Tested on x86_64.  Committed to the branch.


cp/ChangeLog.pph
2011-04-26  Diego Novillo  

* cp-objcp-common.c (cp_common_init_ts): Call
mark_ts_structures_for and tree_node_structure_for_code.
Change calls to MARK_TS_* into assertions instead.

ChangeLog.pph
* tree.c (tree_node_structure_enum): Make extern.
(mark_ts_structures_for): Factor out of
initialize_tree_contains_struct.
(initialize_tree_contains_struct): Call it.
* tree.h (tree_node_structure_for_code): Declare.
(mark_ts_structures_for): Declare.

diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index 6421f6f..ee6 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -227,75 +227,100 @@ init_shadowed_var_for_decl (void)
 void
 cp_common_init_ts (void)
 {
-  MARK_TS_DECL_NON_COMMON (NAMESPACE_DECL);
-  MARK_TS_DECL_NON_COMMON (USING_DECL);
-  MARK_TS_DECL_NON_COMMON (TEMPLATE_DECL);
-
-  MARK_TS_COMMON (TEMPLATE_TEMPLATE_PARM);
-  MARK_TS_COMMON (TEMPLATE_TYPE_PARM);
-  MARK_TS_COMMON (TEMPLATE_PARM_INDEX);
-  MARK_TS_COMMON (OVERLOAD);
-  MARK_TS_COMMON (TEMPLATE_INFO);
-  MARK_TS_COMMON (TYPENAME_TYPE);
-  MARK_TS_COMMON (TYPEOF_TYPE);
-  MARK_TS_COMMON (BASELINK);
-  MARK_TS_COMMON (TYPE_PACK_EXPANSION);
-  MARK_TS_COMMON (EXPR_PACK_EXPANSION);
-  MARK_TS_COMMON (DECLTYPE_TYPE);
-  MARK_TS_COMMON (BOUND_TEMPLATE_TEMPLATE_PARM);
-  MARK_TS_COMMON (UNBOUND_CLASS_TEMPLATE);
-
-  MARK_TS_TYPED (SWITCH_STMT);
-  MARK_TS_TYPED (IF_STMT);
-  MARK_TS_TYPED (FOR_STMT);
-  MARK_TS_TYPED (RANGE_FOR_STMT);
-  MARK_TS_TYPED (AGGR_INIT_EXPR);
-  MARK_TS_TYPED (EXPR_STMT);
-  MARK_TS_TYPED (EH_SPEC_BLOCK);
-  MARK_TS_TYPED (CLEANUP_STMT);
-  MARK_TS_TYPED (SCOPE_REF);
-  MARK_TS_TYPED (CAST_EXPR);
-  MARK_TS_TYPED (NON_DEPENDENT_EXPR);
-  MARK_TS_TYPED (MODOP_EXPR);
-  MARK_TS_TYPED (TRY_BLOCK);
-  MARK_TS_TYPED (THROW_EXPR);
-  MARK_TS_TYPED (HANDLER);
-  MARK_TS_TYPED (REINTERPRET_CAST_EXPR);
-  MARK_TS_TYPED (CONST_CAST_EXPR);
-  MARK_TS_TYPED (STATIC_CAST_EXPR);
-  MARK_TS_TYPED (DYNAMIC_CAST_EXPR);
-  MARK_TS_TYPED (TEMPLATE_ID_EXPR);
-  MARK_TS_TYPED (ARROW_EXPR);
-  MARK_TS_TYPED (SIZEOF_EXPR);
-  MARK_TS_TYPED (ALIGNOF_EXPR);
-  MARK_TS_TYPED (AT_ENCODE_EXPR);
-  MARK_TS_TYPED (UNARY_PLUS_EXPR);
-  MARK_TS_TYPED (TRAIT_EXPR);
-  MARK_TS_TYPED (TYPE_ARGUMENT_PACK);
-  MARK_TS_TYPED (NOEXCEPT_EXPR);
-  MARK_TS_TYPED (NONTYPE_ARGUMENT_PACK);
-  MARK_TS_TYPED (WHILE_STMT);
-  MARK_TS_TYPED (NEW_EXPR);
-  MARK_TS_TYPED (VEC_NEW_EXPR);
-  MARK_TS_TYPED (BREAK_STMT);
-  MARK_TS_TYPED (MEMBER_REF);
-  MARK_TS_TYPED (DOTSTAR_EXPR);
-  MARK_TS_TYPED (DO_STMT);
-  MARK_TS_TYPED (DELETE_EXPR);
-  MARK_TS_TYPED (VEC_DELETE_EXPR);
-  MARK_TS_TYPED (CONTINUE_STMT);
-  MARK_TS_TYPED (TAG_DEFN);
-  MARK_TS_TYPED (PSEUDO_DTOR_EXPR);
-  MARK_TS_TYPED (TYPEID_EXPR);
-  MARK_TS_TYPED (MUST_NOT_THROW_EXPR);
-  MARK_TS_TYPED (STMT_EXPR);
-  MARK_TS_TYPED (OFFSET_REF);
-  MARK_TS_TYPED (OFFSETOF_EXPR);
-  MARK_TS_TYPED (PTRMEM_CST);
-  MARK_TS_TYPED (EMPTY_CLASS_EXPR);
-  MARK_TS_TYPED (VEC_INIT_EXPR);
-  MARK_TS_TYPED (USING_STMT);
-  MARK_TS_TYPED (LAMBDA_EXPR);
+  unsigned i;
+
+  for (i = LAST_AND_UNUSED_TREE_CODE; i < MAX_TREE_CODES; i++)
+{
+  enum tree_node_structure_enum ts_code;
+  enum tree_code code;
+
+  code = (enum tree_code) i;
+  ts_code = tree_node_structure_for_code (code);
+  if (ts_code != LAST_TS_ENUM)
+   {
+ /* All expressions in C++ are typed.  */
+ if (ts_code == TS_EXP)
+   MARK_TS_TYPED (code);
+ mark_ts_structures_for (code, ts_code);
+   }
+  else
+   {
+ /* tree_node_structure_for_code does not recognize language
+specific nodes (unless they use standard code classes).  */
+ MARK_TS_COMMON (code);
+   }
+}
+
+  /* Consistency checks for codes used in the front end.  */
+  gcc_assert (tree_contains_struct[NAMESPACE_DECL][TS_DECL_NON_COMMON]);
+  gcc_assert (tree_contains_struct[USING_DECL][TS_DECL_NON_COMMON]);
+  gcc_assert (tree_contains_struct[TEMPLATE_DECL][TS_DECL_NON_COMMON]);
+
+  gcc_assert (tree_contains_struct[TEMPLATE_TEMPLATE_PARM][TS_COMMON]);
+  gcc_assert (tree_contains_struct[TEMPLATE_TYPE_PARM][TS_COMMON]);
+  gcc_assert (tree_contains_struct[TEMPLATE_PARM_INDEX][TS_COMMON]);
+  gcc_assert (tree_contains_struct[OVERLOAD][TS_COMMON]);
+  gcc_assert (tree_contains_struct[TEMPLATE_INFO][TS_COMMON]);
+  gcc_assert (tree_contains_struct[TYPENAME_TYPE][TS_COMMON]);
+  gcc_assert (tree_contains_struct[TYPEOF_TYPE][TS_COMMON]);
+  gcc_assert (tree_contains_struct[BASELINK][TS_COMMON]);
+  gcc_assert (tree_contains_struct[TYPE_PACK_EXPANSION][TS_COM

Re: C++ PATCH for c++/48281 (ICE with nested initializer_list)

2011-04-26 Thread Jason Merrill

On 03/30/2011 02:05 PM, Jason Merrill wrote:

First I noticed that the crash was due to non-constant CONSTRUCTORs with
TREE_CONSTANT set. So I fixed that, in constructor-const.patch.


It turns out that we need to apply this patch to 4.6 as well, for bug 
48726.  So I'm doing that.


Jason


[pph] Fix many segmentation faults when restoring C++ ASTs (issue4441070)

2011-04-26 Thread Diego Novillo

I have been testing the C++ streamer with a collection of 6,576
C test cases taken from the GCC testsuite.

These C programs build fine with g++, so I encapsulated them inside a
single header file and created a .cc file that simply #includes it.

The intent is to make sure we can PPH generate and read a single
header file.  

Before this patch, we were failing to build about 1,800 test cases.
Most of those failures were due to the streamer reading an LTO tag for
a language-specific code and confusing it with a decl reference.  This
was happening because LTO tag codes were overlapping with language
specific tree codes.

With this patch the number of failures goes from 1,800 to 146.

I will be adding a .exp file to the testsuite in a future patch.
Right now, I'm testing this from a shell script.

Tested on x86_64.  Committed to the branch.


Diego.

ChangeLog.pph
2011-04-26  Diego Novillo  

* lto-streamer.h (enum LTO_tags): Change LTO_bb0 to begin
after MAX_TREE_CODES.

diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index 8d5b1d2..b6f4b79 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -268,7 +268,7 @@ enum LTO_tags
 
  Conversely, to map between LTO tags and tree/gimple codes, the
  reverse operation must be applied.  */
-  LTO_bb0 = 1 + NUM_TREE_CODES + LAST_AND_UNUSED_GIMPLE_CODE,
+  LTO_bb0 = 1 + MAX_TREE_CODES + LAST_AND_UNUSED_GIMPLE_CODE,
   LTO_bb1,
 
   /* EH region holding the previous statement.  */

--
This patch is available for review at http://codereview.appspot.com/4441070


[pph] Write TREE_LANG_FLAG_? fields (issue4430067)

2011-04-26 Thread Diego Novillo
More data we never bothered to stream from GIMPLE but it's important
in the front end.

Tested on x86_64.  Committed to the branch.


cp/ChangeLog.pph
2011-04-26  Diego Novillo  

* pph-streamer-in.c (pph_stream_unpack_value_fields): Read
TREE_LANG_FLAG_? fields.
* pph-streamer-out.c (pph_stream_pack_value_fields): Write
TREE_LANG_FLAG_? fields.

diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c
index c98c2f4..4c5e377 100644
--- a/gcc/cp/pph-streamer-in.c
+++ b/gcc/cp/pph-streamer-in.c
@@ -60,6 +60,14 @@ pph_stream_unpack_value_fields (struct bitpack_d *bp, tree 
expr)
   DECL_LANG_FLAG_7 (expr) = bp_unpack_value (bp, 1);
   DECL_LANG_FLAG_8 (expr) = bp_unpack_value (bp, 1);
 }
+
+  TREE_LANG_FLAG_0 (expr) = bp_unpack_value (bp, 1);
+  TREE_LANG_FLAG_1 (expr) = bp_unpack_value (bp, 1);
+  TREE_LANG_FLAG_2 (expr) = bp_unpack_value (bp, 1);
+  TREE_LANG_FLAG_3 (expr) = bp_unpack_value (bp, 1);
+  TREE_LANG_FLAG_4 (expr) = bp_unpack_value (bp, 1);
+  TREE_LANG_FLAG_5 (expr) = bp_unpack_value (bp, 1);
+  TREE_LANG_FLAG_6 (expr) = bp_unpack_value (bp, 1);
 }
 
 
diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c
index 38c7bbe..a5670c3 100644
--- a/gcc/cp/pph-streamer-out.c
+++ b/gcc/cp/pph-streamer-out.c
@@ -66,6 +66,14 @@ pph_stream_pack_value_fields (struct bitpack_d *bp, tree 
expr)
   bp_pack_value (bp, DECL_LANG_FLAG_7 (expr), 1);
   bp_pack_value (bp, DECL_LANG_FLAG_8 (expr), 1);
 }
+
+  bp_pack_value (bp, TREE_LANG_FLAG_0 (expr), 1);
+  bp_pack_value (bp, TREE_LANG_FLAG_1 (expr), 1);
+  bp_pack_value (bp, TREE_LANG_FLAG_2 (expr), 1);
+  bp_pack_value (bp, TREE_LANG_FLAG_3 (expr), 1);
+  bp_pack_value (bp, TREE_LANG_FLAG_4 (expr), 1);
+  bp_pack_value (bp, TREE_LANG_FLAG_5 (expr), 1);
+  bp_pack_value (bp, TREE_LANG_FLAG_6 (expr), 1);
 }
 
 

--
This patch is available for review at http://codereview.appspot.com/4430067


[pph] Tidy pph_output_tree_* (issue4432071)

2011-04-26 Thread Diego Novillo

No functional changes.  This patch adds a common tree writing function
(pph_output_tree_ref_1) with an additional argument specifying what
tracing level to use to trigger a tracer call.

Calls to pph_output_tree_or_ref() use a default tracing of 2.  For
callers that want to use different tracing levels, they need to call
pph_output_tree_ref_1 directly.

Tested on x86_64.  Committed to pph.

cp/ChangeLog.pph
2011-04-26  Diego Novillo  

* pph-streamer.h (pph_output_tree_or_ref_1): New.
(pph_output_tree_lst): Remove.  Change all
callers to call pph_output_tree_1 with a tracing level of 2.
(pph_output_tree_aux): Remove.  Change all callers to call
pph_output_tree_1 with a tracing level of 3.
(pph_output_tree_or_ref): Call pph_output_tree_or_ref_1 with
a tracing level of 2.

diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c
index 38c7bbe..a5670c3 100644
--- a/gcc/cp/pph-streamer-out.c
+++ b/gcc/cp/pph-streamer-out.c
@@ -244,9 +252,9 @@ pph_stream_write_ld_min (pph_stream *stream, struct 
lang_decl_min *ldm,
 
   gcc_assert (ldm->base.selector == 0);
 
-  pph_output_tree_or_ref (stream, ldm->template_info, ref_p);
+  pph_output_tree_or_ref_1 (stream, ldm->template_info, ref_p, 1);
   if (ldm->base.u2sel == 0)
-pph_output_tree_or_ref (stream, ldm->u2.access, ref_p);
+pph_output_tree_or_ref_1 (stream, ldm->u2.access, ref_p, 1);
   else if (ldm->base.u2sel == 1)
 pph_output_uint (stream, ldm->u2.discriminator);
   else
@@ -787,11 +795,11 @@ pph_stream_write_tree (struct output_block *ob, tree 
expr, bool ref_p)
  pph_stream_write_lang_specific (stream, expr, ref_p);
 
  if (TREE_CODE (expr) == FUNCTION_DECL)
-   pph_output_tree_aux (stream, DECL_SAVED_TREE (expr), ref_p);
+   pph_output_tree_or_ref_1 (stream, DECL_SAVED_TREE (expr), ref_p, 3);
}
 
   if (TREE_CODE (expr) == TYPE_DECL)
-   pph_output_tree_aux (stream, DECL_ORIGINAL_TYPE (expr), ref_p);
+   pph_output_tree_or_ref_1 (stream, DECL_ORIGINAL_TYPE (expr), ref_p, 3);
 }
   else if (TREE_CODE (expr) == STATEMENT_LIST)
 {
@@ -806,7 +814,7 @@ pph_stream_write_tree (struct output_block *ob, tree expr, 
bool ref_p)
 
   /* Write the statements.  */
   for (i = tsi_start (expr); !tsi_end_p (i); tsi_next (&i))
-   pph_output_tree_aux (stream, tsi_stmt (i), ref_p);
+   pph_output_tree_or_ref_1 (stream, tsi_stmt (i), ref_p, 3);
 }
   else if (TYPE_P (expr))
 pph_stream_write_lang_type (stream, expr, ref_p);
@@ -855,7 +863,7 @@ pph_output_chain_filtered (pph_stream *stream, tree first, 
bool ref_p,
   saved_chain = TREE_CHAIN (t);
   TREE_CHAIN (t) = NULL_TREE;
 
-  pph_output_tree_lst (stream, t, ref_p);
+  pph_output_tree_or_ref_1 (stream, t, ref_p, 2);
 
   TREE_CHAIN (t) = saved_chain;
 }
diff --git a/gcc/cp/pph-streamer.h b/gcc/cp/pph-streamer.h
index e0040b2..5c5c2b9 100644
--- a/gcc/cp/pph-streamer.h
+++ b/gcc/cp/pph-streamer.h
@@ -138,33 +138,23 @@ pph_output_tree (pph_stream *stream, tree t, bool ref_p)
   lto_output_tree (stream->ob, t, ref_p);
 }
 
-/* Output AST T to STREAM.  If REF_P is true, output all the leaves of T
-   as references.  This function is an list auxillary routine.  */
-static inline void
-pph_output_tree_lst (pph_stream *stream, tree t, bool ref_p)
-{
-  if (flag_pph_tracer >= 2)
-pph_stream_trace_tree (stream, t, ref_p);
-  lto_output_tree (stream->ob, t, ref_p);
-}
-
-/* Output AST T to STREAM.  If REF_P is true, output all the leaves of T
-   as references.  This function is an internal auxillary routine.  */
+/* Output AST T to STREAM.  If REF_P is true, output a reference to T.
+   If -fpph-tracer is set to TLEVEL or higher, T is sent to
+   pph_stream_trace_tree.  */
 static inline void
-pph_output_tree_aux (pph_stream *stream, tree t, bool ref_p)
+pph_output_tree_or_ref_1 (pph_stream *stream, tree t, bool ref_p, int tlevel)
 {
-  if (flag_pph_tracer >= 3)
+  if (flag_pph_tracer >= tlevel)
 pph_stream_trace_tree (stream, t, ref_p);
-  lto_output_tree (stream->ob, t, ref_p);
+  lto_output_tree_or_ref (stream->ob, t, ref_p);
 }
 
-/* Output AST T to STREAM.  If REF_P is true, output a reference to T.  */
+/* Output AST T to STREAM.  If REF_P is true, output a reference to T.
+   Trigger tracing at -fpph-tracer=2.  */
 static inline void
 pph_output_tree_or_ref (pph_stream *stream, tree t, bool ref_p)
 {
-  if (flag_pph_tracer >= 2)
-pph_stream_trace_tree (stream, t, ref_p);
-  lto_output_tree_or_ref (stream->ob, t, ref_p);
+  pph_output_tree_or_ref_1 (stream, t, ref_p, 2);
 }
 
 /* Write an unsigned int VALUE to STREAM.  */

--
This patch is available for review at http://codereview.appspot.com/4432071


Go patch committed: Use backend interface for struct types

2011-04-26 Thread Ian Lance Taylor
This patch to the Go frontend uses the backend interface for struct
types.  Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian


2011-04-26  Ian Lance Taylor  

* go-gcc.cc (Gcc_backend::struct_type): Implement.


Index: gcc/go/go-gcc.cc
===
--- gcc/go/go-gcc.cc	(revision 172932)
+++ gcc/go/go-gcc.cc	(working copy)
@@ -158,8 +158,7 @@ class Gcc_backend : public Backend
 		source_location);
 
   Btype*
-  struct_type(const std::vector&)
-  { gcc_unreachable(); }
+  struct_type(const std::vector&);
 
   Btype*
   array_type(const Btype* /* element_type */, const Bexpression* /* length */)
@@ -449,6 +448,32 @@ Gcc_backend::function_type(const Btyped_
   return this->make_type(build_pointer_type(fntype));
 }
 
+// Make a struct type.
+
+Btype*
+Gcc_backend::struct_type(const std::vector& fields)
+{
+  tree ret = make_node(RECORD_TYPE);
+  tree field_trees = NULL_TREE;
+  tree* pp = &field_trees;
+  for (std::vector::const_iterator p = fields.begin();
+   p != fields.end();
+   ++p)
+{
+  tree name_tree = get_identifier_from_string(p->name);
+  tree type_tree = p->btype->get_tree();
+  if (type_tree == error_mark_node)
+	return this->error_type();
+  tree field = build_decl(p->location, FIELD_DECL, name_tree, type_tree);
+  DECL_CONTEXT(field) = ret;
+  *pp = field;
+  pp = &DECL_CHAIN(field);
+}
+  TYPE_FIELDS(ret) = field_trees;
+  layout_type(ret);
+  return this->make_type(ret);
+}
+
 // An expression as a statement.
 
 Bstatement*
Index: gcc/go/gofrontend/types.cc
===
--- gcc/go/gofrontend/types.cc	(revision 172932)
+++ gcc/go/gofrontend/types.cc	(working copy)
@@ -2593,7 +2593,7 @@ Function_type::do_get_tree(Gogo* gogo)
   Backend::Btyped_identifier breceiver;
   if (this->receiver_ != NULL)
 {
-  breceiver.name = this->receiver_->name();
+  breceiver.name = Gogo::unpack_hidden_name(this->receiver_->name());
 
   // We always pass the address of the receiver parameter, in
   // order to make interface calls work with unknown types.
@@ -2613,11 +2613,11 @@ Function_type::do_get_tree(Gogo* gogo)
 	   p != this->parameters_->end();
 	   ++p, ++i)
 	{
-	  bparameters[i].name = p->name();
+	  bparameters[i].name = Gogo::unpack_hidden_name(p->name());
 	  bparameters[i].btype = tree_to_type(p->type()->get_tree(gogo));
 	  bparameters[i].location = p->location();
 	}
-  gcc_assert(i == bparameters.size());
+  go_assert(i == bparameters.size());
 }
 
   std::vector bresults;
@@ -2629,11 +2629,11 @@ Function_type::do_get_tree(Gogo* gogo)
 	   p != this->results_->end();
 	   ++p, ++i)
 	{
-	  bresults[i].name = p->name();
+	  bresults[i].name = Gogo::unpack_hidden_name(p->name());
 	  bresults[i].btype = tree_to_type(p->type()->get_tree(gogo));
 	  bresults[i].location = p->location();
 	}
-  gcc_assert(i == bresults.size());
+  go_assert(i == bresults.size());
 }
 
   Btype* fntype = gogo->backend()->function_type(breceiver, bparameters,
@@ -3753,8 +3753,20 @@ Struct_type::method_function(const std::
 tree
 Struct_type::do_get_tree(Gogo* gogo)
 {
-  tree type = make_node(RECORD_TYPE);
-  return this->fill_in_tree(gogo, type);
+  std::vector fields;
+  fields.resize(this->fields_->size());
+  size_t i = 0;
+  for (Struct_field_list::const_iterator p = this->fields_->begin();
+   p != this->fields_->end();
+   ++p, ++i)
+{
+  fields[i].name = Gogo::unpack_hidden_name(p->field_name());
+  fields[i].btype = tree_to_type(p->type()->get_tree(gogo));
+  fields[i].location = p->location();
+}
+  go_assert(i == this->fields_->size());
+  Btype* btype = gogo->backend()->struct_type(fields);
+  return type_to_tree(btype);
 }
 
 // Fill in the fields for a struct type.


Patches ping

2011-04-26 Thread Revital Eres
Hello,

http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00350.html
- Support closing_branch_deps

http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01309.html
- Support instructions with REG_INC_NOTE

http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01294.html
- Avoid considering debug_insn when calculating SCCs

Thanks,
Revital


Re: [patch, libgfortran] Fix numerous formatting bugs

2011-04-26 Thread Jerry DeLisle

On 04/25/2011 07:36 AM, Janne Blomqvist wrote:

On Mon, Apr 25, 2011 at 14:44, Jerry DeLisle  wrote:

On 04/25/2011 03:48 AM, Janne Blomqvist wrote:

Now, for one of the testcase changes:

--- gcc/testsuite/gfortran.dg/char4_iunit_1.f03 (revision 172909)
+++ gcc/testsuite/gfortran.dg/char4_iunit_1.f03 (working copy)
@@ -24,11 +24,11 @@ program char4_iunit_1
write(string, *) .true., .false. , .true.
if (string .ne. 4_" T F T") call
abort
write(string, *) 1.2345e-06, 4.2846e+10_8
-  if (string .ne. 4_"  1.23450002E-06   4284600.00 ") call
abort
+  if (string .ne. 4_"  1.234500019E-06   4284600.00") call
abort

This looks wrong. For correctly rounded REAL(4) output, we need 9
significant digits, but here we print 10.



Well, I bumped it up for defaults based on pr48488 comment #2 shown below.


Yes, that comment in the PR is correct; to guarantee that a
binary->ascii->binary roundtrip preserves the original binary value
(with the default "round to nearest, break on even" rounding mode),
one must output at least {9, 17, 21, 36} significant digits for real
kinds 4, 8, 10, and 16, respectively (yes, I double-checked IEEE
754-2008 that this is indeed correct).

Since for the G edit descriptor d is equivalent to the number of
significant digits, AFAICS the write.c patch below is correct and the
bug must be elsewhere, no?



No.

Look at this example:

program t4
  implicit none
  character(len=44) :: string
  write(*,*) 1.2345e-06, 4.2846e+10_8
  write(*,'(1x,1pG16.9e2,1x,1pG25.17e3)') 1.2345e-06, 4.2846e+10_8
  write(*,'(1x,1pG15.8e2,1x,1pG25.17e3)') 1.2345e-06, 4.2846e+10_8
end program t4

This gives with the patch:

  1.234500019E-06   4284600.00
  1.234500019E-06   4284600.00
  1.23450002E-06   4284600.00

And without the patch:

  1.23450002E-06   4284600.00
  1.234500019E-06   4284600.00
  1.23450002E-06   4284600.00

d is the number of digits after the decimal point, not the number of significant 
digits.


For comaprison, ifort gives:

  1.2345000E-06   4284600.
  1.234500019E-06   4284600.00
  1.23450002E-06   4284600.00

Ifort chooses to use d=7 for list directed.

With that being said, I do think there is possibly a different bug not related 
to the above that I am working on isolating it.  Stay tuned.


Jerry


Re: [patch, libgfortran] Fix numerous formatting bugs

2011-04-26 Thread Jerry DeLisle

On 04/26/2011 09:09 PM, Jerry DeLisle wrote:
---snip---


1.234500019E-06 4284600.00
1.234500019E-06 4284600.00
1.23450002E-06 4284600.00

And without the patch:

1.23450002E-06 4284600.00
1.234500019E-06 4284600.00
1.23450002E-06 4284600.00

d is the number of digits after the decimal point, not the number of significant
digits.

For comaprison, ifort gives:

1.2345000E-06 4284600.
1.234500019E-06 4284600.00
1.23450002E-06 4284600.00

Ifort chooses to use d=7 for list directed.

With that being said, I do think there is possibly a different bug not related
to the above that I am working on isolating it. Stay tuned.

Jerry

Ooops! I fooled my self.  I made a slight mod while testing above and thought I 
had a bug.  Now putting it back all is well.  I am back to the original posted 
patch awaiting approval.


Jerry


C++ PATCH for c++/42687 (arg-dependent lookup regression)

2011-04-26 Thread Jason Merrill
When we fixed using explicit scope to suppress virtual calling, it broke 
using parentheses to suppress argument-dependent lookup.  Fixed thus.


Tested x86_64-pc-linux-gnu, applied to trunk, 4.4, 4.5 and 4.6.
commit 2bc3ed125eab1075ea18c7c80e5ab908130861fd
Author: Jason Merrill 
Date:   Tue Apr 26 21:39:34 2011 -0400

PR c++/42687
* parser.c (cp_parser_primary_expression): Set *idk to
CP_ID_KIND_NONE for a parenthesized identifier.

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 6da285e..68ce052 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -3437,6 +3437,12 @@ cp_parser_primary_expression (cp_parser *parser,
   `&A::B' might be a pointer-to-member, but `&(A::B)' is
   not.  */
finish_parenthesized_expr (expr);
+   /* DR 705: Wrapping an unqualified name in parentheses
+  suppresses arg-dependent lookup.  We want to pass back
+  CP_ID_KIND_QUALIFIED for suppressing vtable lookup
+  (c++/37862), but none of the others.  */
+   if (*idk != CP_ID_KIND_QUALIFIED)
+ *idk = CP_ID_KIND_NONE;
  }
/* The `>' token might be the end of a template-id or
   template-parameter-list now.  */
diff --git a/gcc/testsuite/g++.dg/lookup/koenig13.C 
b/gcc/testsuite/g++.dg/lookup/koenig13.C
new file mode 100644
index 000..625a181
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/koenig13.C
@@ -0,0 +1,16 @@
+// PR c++/42687
+// DR 705
+
+namespace N
+{
+struct S { };
+void f(const S &) { }
+}
+
+void f(const N::S &) { }
+
+int main()
+{
+N::S v;
+(f)(v); // no ambiguity: ADL is prevented with (), only ::f is considered
+}


C++ PATCH to debug_tree for TYPENAME_TYPE and IDENTIFIER

2011-04-26 Thread Jason Merrill
A couple of small changes.  It was inconvenient that debug_tree didn't 
print the name of a TYPENAME_TYPE, and once it did I noticed that the 
indentation on the IDENTIFIER bits was wrong.


Tested x86_64-pc-linux-gnu, applied to trunk.
commit 3d660910ee64db8a09091482370ccc1162b781ca
Author: Jason Merrill 
Date:   Tue Apr 26 18:02:47 2011 -0400

* ptree.c (cxx_print_type) [TYPENAME_TYPE]: Dump fullname.
(cxx_print_identifier): Correct indentation.

diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c
index 49dc82b..a4c3ed5 100644
--- a/gcc/cp/ptree.c
+++ b/gcc/cp/ptree.c
@@ -99,6 +99,11 @@ cxx_print_type (FILE *file, tree node, int indent)
   print_node (file, "expr", DECLTYPE_TYPE_EXPR (node), indent + 4);
   return;
 
+case TYPENAME_TYPE:
+  print_node (file, "fullname", TYPENAME_TYPE_FULLNAME (node),
+ indent + 4);
+  return;
+
 default:
   return;
 }
@@ -175,12 +180,12 @@ cxx_print_identifier (FILE *file, tree node, int indent)
   if (indent == 0)
 fprintf (file, " ");
   else
-indent_to (file, indent);
+indent_to (file, indent + 4);
   cxx_print_binding (file, IDENTIFIER_NAMESPACE_BINDINGS (node), "bindings");
   if (indent == 0)
 fprintf (file, " ");
   else
-indent_to (file, indent);
+indent_to (file, indent + 4);
   cxx_print_binding (file, IDENTIFIER_BINDING (node), "local bindings");
   print_node (file, "label", IDENTIFIER_LABEL_VALUE (node), indent + 4);
   print_node (file, "template", IDENTIFIER_TEMPLATE (node), indent + 4);


Re: [patch, libgfortran] Fix numerous formatting bugs

2011-04-26 Thread Janne Blomqvist
On Wed, Apr 27, 2011 at 07:09, Jerry DeLisle  wrote:
> On 04/25/2011 07:36 AM, Janne Blomqvist wrote:
>>
>> On Mon, Apr 25, 2011 at 14:44, Jerry DeLisle
>>  wrote:
>>>
>>> On 04/25/2011 03:48 AM, Janne Blomqvist wrote:

 Now, for one of the testcase changes:

 --- gcc/testsuite/gfortran.dg/char4_iunit_1.f03 (revision 172909)
 +++ gcc/testsuite/gfortran.dg/char4_iunit_1.f03 (working copy)
 @@ -24,11 +24,11 @@ program char4_iunit_1
    write(string, *) .true., .false. , .true.
    if (string .ne. 4_" T F T                                    ") call
 abort
    write(string, *) 1.2345e-06, 4.2846e+10_8
 -  if (string .ne. 4_"  1.23450002E-06   4284600.00     ") call
 abort
 +  if (string .ne. 4_"  1.234500019E-06   4284600.00    ") call
 abort

 This looks wrong. For correctly rounded REAL(4) output, we need 9
 significant digits, but here we print 10.

>>>
>>> Well, I bumped it up for defaults based on pr48488 comment #2 shown
>>> below.
>>
>> Yes, that comment in the PR is correct; to guarantee that a
>> binary->ascii->binary roundtrip preserves the original binary value
>> (with the default "round to nearest, break on even" rounding mode),
>> one must output at least {9, 17, 21, 36} significant digits for real
>> kinds 4, 8, 10, and 16, respectively (yes, I double-checked IEEE
>> 754-2008 that this is indeed correct).
>>
>> Since for the G edit descriptor d is equivalent to the number of
>> significant digits, AFAICS the write.c patch below is correct and the
>> bug must be elsewhere, no?
>>
>
> No.
>
> Look at this example:
>
> program t4
>  implicit none
>  character(len=44) :: string
>  write(*,*) 1.2345e-06, 4.2846e+10_8
>  write(*,'(1x,1pG16.9e2,1x,1pG25.17e3)') 1.2345e-06, 4.2846e+10_8
>  write(*,'(1x,1pG15.8e2,1x,1pG25.17e3)') 1.2345e-06, 4.2846e+10_8
> end program t4
>
> This gives with the patch:
>
>  1.234500019E-06   4284600.00
>  1.234500019E-06   4284600.00
>  1.23450002E-06   4284600.00
>
> And without the patch:
>
>  1.23450002E-06   4284600.00
>  1.234500019E-06   4284600.00
>  1.23450002E-06   4284600.00
>
> d is the number of digits after the decimal point, not the number of
> significant digits.

I stand corrected. Or well, I still stand by my previous statement
that with the G edit descriptor d corresponds to the number of
significant digits. However, only when not using the scale factor.

Since we use a scale factor of 1, when the magnitude of the number is
such that the E edit descriptor is used, according to F2008 10.7.2.3.3
paragraph 6 for 0 < k < d+2 we must print k significant digits to the
left of the decimal point and d-k+1 to the right. That is, with k=1 we
print one digit to the left of the decimal point and d-1+1=d to the
right which has the effect of increasing the number of significant
digits by one!

However, when the magnitude of the value is such that F editing is
used, the scale factor has no effect and we thus print d significant
digits.

So in order to guarantee an exact binary<->ascii roundtrip we must
accept an extra digit in some cases. Or then do something which would
make list formatted (and perhaps G0 as well?) write differ from 1PGw.d
(effectively, reduce d by one when the magnitude is such that E
editing is used)?

-- 
Janne Blomqvist