Commit Graph

116555 Commits

Author SHA1 Message Date
Dodji Seketeli 7eb918cc4e Make expand_location resolve to locus in main source file
Apparently, quite some places in the compiler (like the C/C++
preprocessor, the debug info machinery) expect expand_location to
resolve to locations that are in the main source file, even if the
token at stake comes from a macro that was defined in a header
somewhere.  Turning on -ftrack-macro-expansion by default was
triggering a lot of failures (not necessarily related to diagnostics)
because expand_location resolves to spelling locations instead.

So I have changed expand_location to honour the initial expectation.

In addition, I came up with the new expand_location_to_spelling_point
used in diagnostic_build_prefix because the diagnostic system, on the
other hand, wants to point to the location of the token where it was
spelled, and then display the error context involving all the macro
whose expansion led to that spelling point - if we are in the context
of a macro expansion there.

This seems to me like a reasonable balance.

Tested and bootstrapped on x86_64-unknown-linux-gnu against trunk and
whitnessed that a lot more tests were PASSing.

Note that the bootstrap with -ftrack-macro-expansion exhibits other
separate issues that are addressed in subsequent patches.  This patch
just fixes one class of problems.

The patch does pass bootstrap with -ftrack-macro-expansion turned off,
though.

gcc/

	* input.c (expand_location_1): New.  Takes a parameter to choose
	whether to resolve the location to spelling or expansion point.
	Was factorized from ...
	(expand_location): ... here.
	(expand_location_to_spelling_point): New.  Implemented in terms of
	expand_location_1.
	* diagnostic.c (diagnostic_build_prefix): Use the new
	expand_location_to_spelling_point instead of expand_location.

From-SVN: r186969
2012-04-30 13:42:00 +02:00
Dodji Seketeli 3600218c8b Fix expansion point loc for macro-like tokens
Consider the test case gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c.
Its interesting part is:

    #define A(x) vari x /* line 7.  */
    #define vari(x)
    #define B , varj
    int A(B) ;  /* line 10.  */

In its initial version, this test was being pre-processed as:

    # 1 "gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c"
    # 1 "build/gcc//"
    # 1 "<command-line>"
    # 1 "gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c"
    # 10 "gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c"
    int
    # 7 "gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c"
		 vari

	, varj ;

Note how "int" and "vari" are on separate lines, whereas "int" and
", varj" are on the same line.

This looks like a bug to me, even independantly from the macro
location tracking work.

With macro location tracking turned on, the preprocessed output
becomes:

    # 1 "gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c"
    # 1 "<command-line>"
    # 1 "gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c"
    # 10 "gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c"
    int vari , varj ;

Which, IMO, is what we'd expect.

This is due to an unexpected side effect of enter_macro_context when
passed a token that might look like a function-like macro at first
sight, but that it eventually considers to not be a macro after all.

This is the case for the "vari" token which looks like a macro when it
is first lexed, but is eventually considered to be a normal token by
enter_macro_context because it's not used as a function-like macro
invocation.

In that case, besides returning NULL, enter_macro_context sets
pfile->context->c.macro to NULL, making cpp_get_token_1 forget to set
the location of the "vari" to the expansion point of A.

enter_macro_context sets pfile->context->c.macro to NULL in that case
because funlike_invocation_p reads one token pass "foo", sees that
there is no '(' token, so we are not invoking the function-like
parameter.  It then puts the tokens (which it has read after "foo")
back into the tokens stream by calling _cpp_push_token_context on it,
which sets pfile->context->c.macro to NULL, saying in essence that the
current macro expansion context is "stopped".

The fix here is to teach _cpp_push_token and
push_extended_tokens_context to continue the current macro context
when passed a NULL macro.  But then, now that there can be several
continguous contexts associated with the same macro, we need to teach
_cpp_pop_context to re-enable the expansion of the current macro only
when we are really out of expanding the current macro.  Otherwise we
can run in cases where we have recursive expansions of the same macro.

Tested on x86_64-unknown-linux-gnu against trunk.  Now this test has
the same output with and without tracking locations accross macro
expansions.

Note that the bootstrap with -ftrack-macro-expansion exhibits other
separate issues that are addressed in subsequent patches.  This patch
just fixes one class of problems.

The patch does pass bootstrap with -ftrack-macro-expansion turned off,
though.

libcpp/
	* macro.c (macro_of_context): New static function.
	(_cpp_push_token_context, push_extended_tokens_context): If the
	macro argument is NULL, it means we are continuing the expansion
	of the current macro, if any.  Update comments.
	(_cpp_pop_context): Re-enable expansion of the macro only when we
	are really out of the context of the current expansion.

gcc/testsuite/

	* gcc.dg/debug/dwarf2/pr41445-5.c: Adjust.
	* gcc.dg/debug/dwarf2/pr41445-6.c: Likewise.

From-SVN: r186968
2012-04-30 13:41:46 +02:00
Dodji Seketeli 163fa1ebba Fix PCH crash on GTYed pointer-to-scalar field of a struct
When -ftrack-macro-expansion is activated, the PCH generation
machinery can crash in gt_pch_save when it's about to relocate the
pointer for the
line_maps::info_macro::maps[i]::d.macro.macro_locations member.

The call that crashes (in ggc-common.c) is:

    state.ptrs[i]->note_ptr_fn (state.ptrs[i]->obj,
				state.ptrs[i]->note_ptr_cookie,
				relocate_ptrs, &state);

The ->note_ptr_fn called in this case is the gengtype-generated
gt_pch_p_9line_maps function.  It crashes because the second argument
passed to it is a pointer to struct line_map, instead of being a
pointer to struct line_maps (extra 's') like what the function
expects.

You can see the crash for the test case:

    runtest --tool g++ --tool_opts="-ftrack-macro-expansion" pch.exp=system-1.C

I believe it's because a part of the code of gt_pch_nx_line_maps
(generated as part of gtype-desc.c by gengtype) is not correct.  Note
that this gt_pch_nx_line_maps function is called from gt_pch_save in
the snippet:

  for (rt = gt_ggc_rtab; *rt; rt++)
    for (rti = *rt; rti->base != NULL; rti++)
      for (i = 0; i < rti->nelt; i++)
	(*rti->pchw)(*(void **)((char *)rti->base + rti->stride * i));

So, in that gt_pch_nx_line_maps, in the branch that starts with the
code:

      if ((*x).info_macro.maps != NULL) {
        size_t i3;
        for (i3 = 0; i3 != (size_t)(((*x).info_macro).used); i3++) {
          switch (((*x).info_macro.maps[i3]).reason == LC_ENTER_MACRO)

we have the code:

    gt_pch_note_object ((*x).info_macro.maps[i3].d.macro.macro_locations,
			(*x).info_macro.maps,
			 gt_pch_p_9line_maps,
			  gt_types_enum_last);

This last snippet registers gt_pch_p_9line_maps to be called on the
object pointed by (*x).info_macro.maps[i3].d.macro.macro_locations (as
a first argument), with (*x).info_macro.maps as its second argument.

Note that (*x).info_macro.maps is of type struct line_map*, while 'x'
is of type struct line_maps* - beware, there is an 's' at the end of
the latter.

The problem is that gt_pch_p_9line_maps requires that its second
argument be an instance of _struct line_maps_, not struct line_map.
So later when gt_pch_p_9line_maps is called, it just crashes.

More generally, these gt_pch_p_xxx functions seem to require that
their second argument be an instance of the xxx in question.  And that
invariant is violated by the snippet of code above.

The invariant seems to be violated only for the case where a GTYed
structure (possibly embedded in another GTYed structure) contains a
pointer to a scalar (that is not a string) which memory is ggc/GTY
managed, like the line_map_macro::macro_locations field.  And this
only happens for PCH generation.

Looking at gengtype.c, it seems like write_types_process_field can be
fooled in that case.  It expects that the expression d->prev_val[3]
contains the name of the second argument of the gt_pch_p_xxx (which is
generically referenced by wtd->subfield_marker_routine there).  That
expression can resolve to either "x", as we would like it to be, but
can also resolve to another arbitrary name for e.g, the case of a
pointer-to-struct used as a root).

This patch simply forces the second argument of gt_pch_p_xxx to be 'x'
even in the case of a member that is a pointer to a scalar.

As a result, here is the the diff the new generated gtype-desc.c file:

@@ -5234,7 +5234,7 @@ gt_pch_nx_line_maps (void *x_p)
                 size_t i2;
                 for (i2 = 0; i2 != (size_t)(2 * ((*x).info_ordinary.maps[i0].d.macro).n_tokens); i2++) {
                 }
-                gt_pch_note_object ((*x).info_ordinary.maps[i0].d.macro.macro_locations, (*x).info_ordinary.maps, gt_pch_p_9line_maps, gt_types_enum_last);
+                gt_pch_note_object ((*x).info_ordinary.maps[i0].d.macro.macro_locations, x, gt_pch_p_9line_maps, gt_types_enum_last);
               }
               break;
             default:
@@ -5261,7 +5261,7 @@ gt_pch_nx_line_maps (void *x_p)
                 size_t i5;
                 for (i5 = 0; i5 != (size_t)(2 * ((*x).info_macro.maps[i3].d.macro).n_tokens); i5++) {
                 }
-                gt_pch_note_object ((*x).info_macro.maps[i3].d.macro.macro_locations, (*x).info_macro.maps, gt_pch_p_9line_maps, gt_types_enum_last);
+                gt_pch_note_object ((*x).info_macro.maps[i3].d.macro.macro_locations, x, gt_pch_p_9line_maps, gt_types_enum_last);
               }
               break;
             default:
@@ -9366,7 +9366,7 @@ gt_pch_na_regno_reg_rtx (ATTRIBUTE_UNUSED void *x_p)
     for (i1 = 0; i1 != (size_t)(crtl->emit.x_reg_rtx_no); i1++) {
       gt_pch_n_7rtx_def (regno_reg_rtx[i1]);
     }
-    gt_pch_note_object (regno_reg_rtx, &regno_reg_rtx, gt_pch_pa_regno_reg_rtx, gt_types_enum_last);
+    gt_pch_note_object (regno_reg_rtx, x, gt_pch_pa_regno_reg_rtx, gt_types_enum_last);
   }
 }

I think it's pretty much what I was willing to have.

Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.

Note that the bootstrap with -ftrack-macro-expansion exhibits
other separate issues that are addressed in subsequent patches.
This patch just fixes one class of problems.

The patch does pass bootstrap with -ftrack-macro-expansion turned
off, though.

gcc/

	* gengtype.c (write_types_process_field):  Force second argument
	of the call to the PCH object hierarchy walker to be 'x'.

From-SVN: r186967
2012-04-30 13:41:34 +02:00
Dodji Seketeli 0ff2b8a022 Fix token pasting with -ftrack-macro-expansion
This patch makes token pasting work with -ftrack-macro-expansion
turned on.  It improves some pasting related tests of the gcc.dg/cpp
subdirectory.

Tested and bootstrapped on x86_64-unknown-linux-gnu against trunk.

Note that the bootstrap with -ftrack-macro-expansion exhibits other
separate issues that are addressed in subsequent patches.  This patch
just fixes one class of problems.

The patch does pass bootstrap with -ftrack-macro-expansion turned off,
though.

libcpp/

	* macro.c (paste_all_tokens): Put the token resulting from pasting
	into an extended token context with -ftrack-macro-location is in
	effect.

gcc/testsuite/

	* gcc.dg/cpp/paste17.c: New test case for
	-ftrack-macro-expansion=2 mode only.
	* gcc.dg/cpp/macro-exp-tracking-5.c: Likewise.

From-SVN: r186966
2012-04-30 13:41:21 +02:00
Dodji Seketeli 4e65a47055 Fix cpp_sys_macro_p with -ftrack-macro-expansion
cpp_sys_macro_p crashes when -ftrack-macro-expansion is on.  The issue
can be reproduced by running the tests:

    runtest --tool gcc --tool_opts="-ftrack-macro-expansion" cpp.exp=sysmac1.c
    runtest --tool gcc --tool_opts="-ftrack-macro-expansion" cpp.exp=sysmac2.c

This is because it just doesn't support that mode.  Fixed thus.
Tested and bootstrapped on x86_64-unknown-linux-gnu against trunk.

Note that the bootstrap with -ftrack-macro-expansion turned on
exhibits other separate issues that are addressed in subsequent
patches.  This patch just fixes one class of problems.

The patch does pass bootstrap with -ftrack-macro-expansion turned off,
though.

libcpp/

	* macro.c (cpp_sys_macro_p):  Support -ftrack-macro-expansion.

From-SVN: r186965
2012-04-30 13:41:08 +02:00
Eric Botcazou b38086f06a decl.c (gnat_to_gnu_entity): In type annotation mode...
* gcc-interface/decl.c (gnat_to_gnu_entity): In type annotation mode,
	do not adjust the size of a tagged type if there is a representation
	clause on it.  Otherwise, round the adjustment up to the alignment
	of the first field and use the appropriate helper routine.
	(maybe_pad_type): Do not warn in type annotation mode on a tagged type.
	(gnat_to_gnu_field): Do not error out under the same circumstances.
	(annotate_rep): In type annotation mode, do not adjust the offset of
	components of a tagged type with representation clause.  Otherwise,
	round the adjustment up to the alignment of the first field.

From-SVN: r186961
2012-04-30 08:31:29 +00:00
Eric Botcazou bb358f1cd9 i386.c (ix86_handle_struct_attribute): Use the proper predicate to discriminate types.
* config/i386/i386.c (ix86_handle_struct_attribute): Use the proper
	predicate to discriminate types.
ada/
	* gcc-interface/utils.c (finish_record_type): Force the traditional GCC
	layout for bitfields on the type if it is packed or has a representation
	clause and an alternate layout is available.

From-SVN: r186958
2012-04-30 08:11:42 +00:00
Manuel López-Ibáñez e6c69da096 c-common.c (check_function_arguments): Replace Wmissing-format-attribute with Wsuggest-attribute=format.
2012-04-30  Manuel López-Ibáñez  <manu@gcc.gnu.org>

        * c-common.c (check_function_arguments): Replace
        Wmissing-format-attribute with Wsuggest-attribute=format.

From-SVN: r186957
2012-04-30 08:02:53 +00:00
Eric Botcazou f04b8d6927 gigi.h (mark_out_of_scope): Delete.
* gcc-interface/gigi.h (mark_out_of_scope): Delete.
	(destroy_gnat_to_gnu): Declare.
	(destroy_dummy_type): Likewise.
	* gcc-interface/decl.c (mark_out_of_scope): Delete.
	* gcc-interface/utils.c (destroy_gnat_to_gnu): New function.
	(destroy_dummy_type): Likewise.
	* gcc-interface/trans.c (gnat_validate_uc_list): New variable.
	(gigi): Call validate_unchecked_conversion on gnat_validate_uc_list
	after the translation is completed.  Call destroy_gnat_to_gnu and
	destroy_dummy_type at the end.
	(Subprogram_Body_to_gnu): Do not call mark_out_of_scope.
	(gnat_to_gnu) <N_Block_Statement>: Likewise.
	<N_Validate_Unchecked_Conversion>: Do not process the node, only push
	it onto gnat_validate_uc_list.
	(validate_unchecked_conversion): New function.

From-SVN: r186956
2012-04-30 07:50:07 +00:00
Manuel López-Ibáñez 90137d8f2c invoke.texi (Wmissing-format-attribute): Document as an alias of Wsuggest-attribute=format.
2012-04-30  Manuel López-Ibáñez  <manu@gcc.gnu.org>

gcc/
	* doc/invoke.texi (Wmissing-format-attribute): Document as an
	alias of Wsuggest-attribute=format.
c-family/
	* c.opt (Wsuggest-attribute=format): New. Alias of
	Wmissing-format-attribute.
	* c-format.c (decode_format_type): Replace
	Wmissing-format-attribute with Wsuggest-attribute=format.
	(check_function_format): Likewise.
cp/
	* typeck.c (convert_for_assignment):  Replace
	Wmissing-format-attribute with Wsuggest-attribute=format.
	* call.c (convert_for_arg_passing): Likewise.
gcc/
	* c-typeck.c (convert_for_assignment): Replace
	Wmissing-format-attribute with Wsuggest-attribute=format.
	(digest_init): Likewise.

From-SVN: r186955
2012-04-30 07:42:42 +00:00
GCC Administrator 70c33a85a6 Daily bump.
From-SVN: r186952
2012-04-30 00:18:41 +00:00
Marc Glisse cf48c25519 re PR libstdc++/51795 (linear_congruential_engine doesn't work correctly)
2012-04-29  Marc Glisse  <marc.glisse@inria.fr>
	    Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/51795
	* include/bits/stl_algobase.h (__lg<>(_Size)): Remove.
	(__lg(int), __lg(unsigned), __lg(long), __lg(unsigned long),
	__lg(long long), __lg(unsigned long long)): Define constexpr.
	* include/bits/random.h (_Mod<>): Overcome Schrage's algorithm
	limitations.
	(__mod): Adjust.
	(linear_congruential): Remove FIXME static_assert.
	* include/bits/random.tcc (_Mod<>): Adjust.
	* testsuite/26_numerics/random/linear_congruential_engine/operators/
	51795.cc: New.

Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com>

From-SVN: r186948
2012-04-29 23:36:09 +00:00
Jonathan Wakely 143a1ce16c functional (function::function(F)): LWG 2132: Disable constructor if argument isn't callable.
* include/std/functional (function::function(F)): LWG 2132: Disable
	constructor if argument isn't callable.
	* testsuite/20_util/function/cons/callable.cc: New.

From-SVN: r186947
2012-04-29 23:59:37 +01:00
Dodji Seketeli 112448b448 Don't use C++ style comments in libcpp
I noticed that the file lex.c had C++ style comments, which I believe
is against the coding standards of the project.

Fixed, tested and applied to master as per the obvious rule.

libcpp/

	* lex.c (lex_raw_string): Change C++ style comments into C
	style comments.
	(lex_string): Likewise.

From-SVN: r186946
2012-04-29 18:27:08 +02:00
Manuel López-Ibáñez 663b01340b re PR regression/53149 (gcc.dg/20011021-1.c)
2012-04-29  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR 53149
        * gcc.dg/20011021-1.c: Adjust testcase.

From-SVN: r186945
2012-04-29 09:47:43 +00:00
Marc Glisse 1c8300874e re PR libstdc++/22200 (numeric_limits<signed>::is_modulo is inconsistent with gcc)
2012-04-29  Marc Glisse  <marc.glisse@inria.fr>

	PR libstdc++/22200
    	* include/std/limits (numeric_limits<>::is_modulo): False for
    	signed types.

From-SVN: r186944
2012-04-29 09:25:17 +00:00
Manuel López-Ibáñez 94ee697923 opts.c (finish_options): Do not handle -Wmissing-noreturn here.
2012-04-29  Manuel López-Ibáñez  <manu@gcc.gnu.org>

        * opts.c (finish_options): Do not handle -Wmissing-noreturn here.
        * common.opt (Wmissing-noreturn): Alias of -Wsuggest-attribute=noreturn.

From-SVN: r186943
2012-04-29 09:15:30 +00:00
Thomas Koenig 3d3b81932d re PR fortran/53148 (Incorrect intrinsic function parsing on labeled statements when compiled w/ -ffrontend-optimize)
2012-04-29  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/53148
	* frontend-passes.c (create_var):  If the statement has a label,
	put the label around the block.

2012-04-29  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/53148
	* gfortran.dg/function_optimize_12.f90:  New test.

From-SVN: r186942
2012-04-29 07:12:03 +00:00
Hans-Peter Nilsson 78900a5421 re PR target/53156 (gcc.target/cris/peep2-andu2.c)
PR target/53156
	* gcc.target/cris/peep2-andu2.c: Tweak expected assembly
	code to match current output and cover new peephole2 pattern.

From-SVN: r186941
2012-04-29 07:00:01 +00:00
Hans-Peter Nilsson ff2ca1bca5 re PR target/53156 (gcc.target/cris/peep2-andu2.c)
PR target/53156
	* config/cris/cris.md (andqu): New peephole2.
	(andu): Tweak head comment.

From-SVN: r186940
2012-04-29 06:59:09 +00:00
GCC Administrator 2a640b5143 Daily bump.
From-SVN: r186938
2012-04-29 00:18:47 +00:00
Doug Evans d028426aa1 * dwarf2.def (DW_OP): Add DW_OP_GNU_addr_index.
From-SVN: r186934
2012-04-28 21:37:19 +00:00
Aurelien Jarno e4bb767ec3 config.host (mips64*-*-linux*, [...]): Remove.
libgcc/
2012-04-28  Aurelien Jarno  <aurelien@aurel32.net>

	* config.host (mips64*-*-linux*, mipsisa64*-*-linux*): Remove. 
	(mips*-*-linux*): Include mips/t-tpbit when long double is 
	16 bytes long.

From-SVN: r186931
2012-04-28 08:03:54 +00:00
Ian Lance Taylor 69f232c5a1 compiler: Fix some crashes on invalid code.
Fixes issue 7.

From-SVN: r186929
2012-04-28 04:56:55 +00:00
Joern Rennecke fa06ad0d58 re PR tree-optimization/38785 (huge performance regression on EEMBC bitmnp01)
PR tree-optimization/38785
	* common.opt (ftree-partial-pre): New option.
	* doc/invoke.texi: Document it.
	* opts.c (default_options_table): Initialize flag_tree_partial_pre.
	* tree-ssa-pre.c (do_partial_partial_insertion): Insert only if it will
	benefit speed path.
	(execute_pre): Use flag_tree_partial_pre.

Co-Authored-By: Maxim Kuvyrkov <maxim@codesourcery.com>
Co-Authored-By: Steven Bosscher <steven@gcc.gnu.org>

From-SVN: r186928
2012-04-28 01:56:54 +00:00
Ian Lance Taylor 52556f0477 compiler: Use less memory for array/slice literals.
Fixes issue 8 in gofrontend issues list.

From-SVN: r186926
2012-04-28 00:29:23 +00:00
GCC Administrator cd5cec4abf Daily bump.
From-SVN: r186925
2012-04-28 00:18:20 +00:00
John David Anglin 5f5f36f91b re PR target/52999 (ICE, segmentation fault in c_tree_printer)
PR target/52999
	* config/pa/pa.c (pa_legitimate_constant_p): Don't put function labels
	in constant pool.

From-SVN: r186919
2012-04-27 20:41:16 +00:00
Tom Tromey accea0346f * dwarf2.h: Wrap function declarations in extern "C".
From-SVN: r186918
2012-04-27 16:58:53 +00:00
Ian Lance Taylor 324612b351 re PR go/52358 (math FAILs on Solaris 8 and 9)
PR go/52358
configure, runtime: Provide i386 long double math functions if needed.

From-SVN: r186915
2012-04-27 16:38:11 +00:00
Ian Lance Taylor 6c88c77ec7 re PR go/52358 (math FAILs on Solaris 8 and 9)
PR go/52358
math: Work around bug in Solaris 9 implementation of ldexp.

The bug is that ldexp(-1, -1075) should return -0, but the
Solaris 9 implementation returns +0.

From-SVN: r186913
2012-04-27 16:32:42 +00:00
Ian Lance Taylor f07bb470ae runtime: Correct syscall.Setenv for systems that don't have setenv.
From-SVN: r186911
2012-04-27 16:28:21 +00:00
Ollie Wild 7f5f5f98c5 Add new option, -Wliteral-suffix.
This option, which is enabled by default, causes the preprocessor to warn
when a string or character literal is followed by a ud-suffix which does
not begin with an underscore.  According to [lex.ext]p10, this is
ill-formed.

Also modifies the preprocessor to treat such ill-formed suffixes as separate
preprocessing tokens.  This is consistent with the Clang front end (see
http://llvm.org/viewvc/llvm-project?view=rev&revision=152287), and enables
backwards compatibility with code that uses formatting macros from
<inttypes.h>, as in the following code block:

  int main() {
    int64_t i64 = 123;
    printf("My int64: %"PRId64"\n", i64);
  }

Google ref b/6377711.

2012-04-27   Ollie Wild  <aaw@google.com>

	PR c++/52538
	* gcc/c-family/c-common.c: Add CPP_W_LITERAL_SUFFIX mapping.
	* gcc/c-family/c-opts.c (c_common_handle_option): Handle
	OPT_Wliteral_suffix.
	* gcc/c-family/c.opt: Add Wliteral-suffix.
	* gcc/doc/invoke.texi (Wliteral-suffix): Document new option.
	* gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix.c: New test.
	* libcpp/include/cpplib.h (struct cpp_options): Add new field,
	warn_literal_suffix.
	(CPP_W_LITERAL_SUFFIX): New enum.
	* libcpp/init.c (cpp_create_reader): Default initialization of
	warn_literal_suffix.
	* libcpp/lex.c (lex_raw_string): Treat user-defined literals which
	don't begin with '_' as separate tokens and produce a warning.
	(lex_string): Ditto.

From-SVN: r186909
2012-04-27 14:29:32 +00:00
Tom Tromey 11ec770e46 dwarf2out.c (dwarf_stack_op_name): Use get_DW_OP_name.
gcc
	* dwarf2out.c (dwarf_stack_op_name): Use get_DW_OP_name.
	(dwarf_tag_name): Use get_DW_TAG_name.
	(dwarf_attr_name): Use get_DW_AT_name.
	(dwarf_form_name): Use get_DW_FORM_name.
	* dwarf2cfi.c (dwarf_cfi_name): Use get_DW_CFA_name.
include
	* dwarf2.h (enum dwarf_tag, enum dwarf_form, enum dwarf_attribute)
	(enum dwarf_location_atom, enum dwarf_type, enum
	dwarf_call_frame_info): Remove.
	(DW_TAG, DW_TAG_DUP, DW_FORM, DW_AT, DW_AT_DUP, DW_OP)
	(DW_OP_DUP, DW_ATE, DW_ATE_DUP, DW_CFA): New macros.
	Include dwarf2.def.
	(get_DW_TAG_name, get_DW_AT_name, get_DW_FORM_name)
	(get_DW_OP_name, get_DW_ATE_name): Declare.
	* dwarf2.def: New file, from dwarf2.h.
libiberty
	* dwarfnames.c: New file.
	* Makefile.in (CFILES): Add dwarfnames.
	(REQUIRED_OFILES): Add dwarfnames.
	(./dwarfnames.$(objext)): New target.

From-SVN: r186908
2012-04-27 14:14:14 +00:00
Paolo Bonzini 809c929ccf tree-ssa-phiopt.c (conditional_replacement): Replace PHIs whose arguments are -1 and 0...
2012-04-27  Paolo Bonzini  <bonzini@gnu.org>

	* tree-ssa-phiopt.c (conditional_replacement): Replace PHIs
	whose arguments are -1 and 0, by negating the result of the
	conditional.

testsuite:
2012-04-27  Paolo Bonzini  <bonzini@gnu.org>

	* gcc.c-torture/execute/20120427-2.c: New testcase.
	* gcc.dg/tree-ssa/phi-opt-10.c: New testcase.
	* gcc.dg/tree-ssa/ssa-pre-28.c: Bypass new optimization.
	* gcc.dg/tree-ssa/ssa-ifcombine-7.c: Look into ifcombine dump.

From-SVN: r186905
2012-04-27 12:20:01 +00:00
Paolo Bonzini d554870991 re PR target/53138 (spaceship operator miscompiled)
2012-04-27  Paolo Bonzini  <bonzini@gnu.org>

        PR target/53138
        * config/i386/i386.md (x86_mov<mode>cc_0_m1_neg): Add clobber.

testsuite:
2012-04-27  Paolo Bonzini  <bonzini@gnu.org>

        PR target/53138
        * gcc.c-torture/execute/20120427-1.c: New testcase.

From-SVN: r186904
2012-04-27 12:17:50 +00:00
Richard Guenther 209be55309 tree-flow.h (is_hidden_global_store): Remove.
2012-04-27  Richard Guenther  <rguenther@suse.de>

	* tree-flow.h (is_hidden_global_store): Remove.
	* tree-ssa-sink.c (is_hidden_global_store): Likewise.
	* tree-ssa-alias.h (ref_may_alias_global_p): Declare.
	(stmt_may_clobber_global_p): Likewise.
	* tree-ssa-alias.c (ref_may_alias_global_p): New function.
	(stmt_may_clobber_global_p): Likewise.
	* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Call
	stmt_may_clobber_global_p.
	* tree-ssa-dse.c (dse_possible_dead_store_p): Likewise.

From-SVN: r186903
2012-04-27 11:58:20 +00:00
Steven Bosscher c813039daf cfg.c (disconnect_src): Do df_mark_solutions_dirty in the right place.
* cfg.c (disconnect_src): Do df_mark_solutions_dirty in the right
	place.

From-SVN: r186902
2012-04-27 11:12:52 +00:00
Steven Bosscher 886cd84f72 tree-switch-conversion.c (struct switch_conv_info): Add range_max, reorganize some fields and update comments.
gcc/
	* tree-switch-conversion.c (struct switch_conv_info): Add range_max,
	reorganize some fields and update comments.  Rename bit_test_uniq
	and bit_test_count to uniq resp. count.  Remove bit_test_bb.
	(collect_switch_conv_info): New function, collects info about a
	GIMPLE_SWITCH into a struct switch_conv_info.
	(check_range): Simplify to use pre-recorded info.  Fix think-o in
	range-branch ratio check.
	(check_process_case): Remove function.
	(check_all_empty_except_final): New function, verifies that all
	non-final basic blocks are empty.
	(process_switch): Simplify to use pre-recorded info.  Call
	collect_switch_conv_info to do that.  Assert that degenerate switch
	statements have been cleaned up.

From-SVN: r186901
2012-04-27 11:11:45 +00:00
Marc Glisse 07ab2b1b27 re PR middle-end/27139 (Optimize double INT->FP->INT conversions with -ffast-math)
2012-04-27  Marc Glisse  <marc.glisse@inria.fr>

	PR middle-end/27139
	* tree-ssa-forwprop.c (combine_conversions): Handle INT->FP->INT.

	* gcc.dg/tree-ssa/forwprop-18.c: New test.

From-SVN: r186898
2012-04-27 10:34:13 +00:00
Manuel López-Ibáñez ae9331288f re PR regression/53130 (gcc.dg/20011021-1.c, gcc.dg/m-un-2.c, gcc.dg/missing-field-init-2.c)
2012-04-25  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/53130
	* c-typeck.c (pop_init_level): Use %qD instead of %qT.

From-SVN: r186896
2012-04-27 08:21:49 +00:00
Tom de Vries b5f5f2fd37 re PR tree-optimization/51879 (Missed tail merging with non-const/pure calls)
2012-04-27  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/51879
	* gcc.dg/pr51879.c: New test.
	* gcc.dg/pr51879-2.c: Same.
	* gcc.dg/pr51879-3.c: Same.
	* gcc.dg/pr51879-4.c: Same.
	* gcc.dg/pr51879-6.c: Same.

From-SVN: r186895
2012-04-27 06:28:49 +00:00
Tom de Vries 0011592137 re PR tree-optimization/51879 (Missed tail merging with non-const/pure calls)
2012-04-27  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/51879
	* tree-ssa-sccvn.h (struct vn_reference_s): Add result_vdef field.
	* tree-ssa-sccvn.c (mark_use_processed): New function, factored out
	of ...
	(defs_to_varying): ... here.  Don't set use_processed.
	(visit_reference_op_call): Handle gimple_vdef.
	Handle case that lhs is NULL_TREE.
	(visit_use): Use mark_use_processed.  Handle calls with side-effect
	using visit_reference_op_call.

From-SVN: r186894
2012-04-27 06:12:49 +00:00
GCC Administrator c9dd1d3940 Daily bump.
From-SVN: r186892
2012-04-27 00:18:06 +00:00
Paolo Carlini df16e146cf re PR c++/53096 ([DR 1333] [c++11] should be possible to default a copy ctor that takes non-const arg)
/cp
2012-04-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/53096
	* class.c (check_bases_and_members): Implement core/1333, do not
	disallow defaulted in the class body non-const ref special members.

/testsuite
2012-04-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/53096
	* g++.dg/cpp0x/defaulted35.C: New.
	* g++.dg/cpp0x/defaulted15.C: Adjust.

From-SVN: r186888
2012-04-26 23:32:14 +00:00
Richard Sandiford fd59643c20 sched-deps.c (fixup_sched_groups): Rename to...
gcc/
	* sched-deps.c (fixup_sched_groups): Rename to...
	(chain_to_prev_insn): ...this.
	(chain_to_prev_insn_p): New function.
	(deps_analyze_insn): Use it instead of SCHED_GROUP_P.

From-SVN: r186883
2012-04-26 15:49:44 +00:00
Richard Sandiford 7a1aca9c42 sched-int.h (_haifa_insn_data): Move priority_status.
gcc/
	* sched-int.h (_haifa_insn_data): Move priority_status.
	Add model_index.
	(INSN_MODEL_INDEX): New macro.
	* haifa-sched.c (insn_delay): New function.
	(sched_regno_pressure_class): Update commentary.
	(mark_regno_birth_or_death): Pass the liveness bitmap and
	pressure array as arguments, instead of using curr_reg_live and
	curr_reg_pressure.  Only update the pressure if the bit in the
	liveness set has changed.
	(initiate_reg_pressure_info): Always trust the live-in set for
	SCHED_PRESSURE_MODEL.
	(initiate_bb_reg_pressure_info): Update call to
	mark_regno_birth_or_death.
	(dep_list_size): Take the list as argument.
	(calculate_reg_deaths): New function, extracted from...
	(setup_insn_reg_pressure_info): ...here.
	(MODEL_BAR): New macro.
	(model_pressure_data, model_insn_info, model_pressure_limit)
	(model_pressure_group): New structures.
	(model_schedule, model_worklist, model_insns, model_num_insns)
	(model_curr_point, model_before_pressure, model_next_priority):
	New variables.
	(MODEL_PRESSURE_DATA, MODEL_MAX_PRESSURE, MODEL_REF_PRESSURE)
	(MODEL_INSN_INFO, MODEL_INSN): New macros.
	(model_index, model_update_limit_points_in_group): New functions.
	(model_update_limit_points, model_last_use_except): Likewise.
	(model_start_update_pressure, model_update_pressure): Likewise.
	(model_recompute, model_spill_cost, model_excess_group_cost): Likewise.
	(model_excess_cost, model_dump_pressure_points): Likewise.
	(model_set_excess_costs): Likewise.
	(rank_for_schedule): Extend SCHED_PRIORITY_WEIGHTED ordering to
	SCHED_PRIORITY_MODEL.  Use insn_delay.  Use the order in the model
	schedule as an alternative tie-breaker.  Update the call to
	dep_list_size.
	(ready_sort): Call model_set_excess_costs.
	(update_register_pressure): Update call to mark_regno_birth_or_death.
	Rely on that function to check liveness rather than doing it here.
	(model_classify_pressure, model_order_p, model_add_to_worklist_at)
	(model_remove_from_worklist, model_add_to_worklist, model_promote_insn)
	(model_add_to_schedule, model_analyze_insns, model_init_pressure_group)
	(model_record_pressure, model_record_pressures): New functions.
	(model_record_final_pressures, model_add_successors_to_worklist)
	(model_promote_predecessors, model_choose_insn): Likewise.
	(model_reset_queue_indices, model_dump_pressure_summary): Likewise.
	(model_start_schedule, model_finalize_pressure_group): Likewise.
	(model_end_schedule): Likewise.
	(schedule_insn): Say when we're scheduling the next instruction
	in the model schedule.
	(schedule_insn): Handle SCHED_PRESSURE_MODEL.
	(queue_to_ready): Do not add instructions that are
	MAX_SCHED_READY_INSNS beyond the current point of the model schedule.
	Always allow the next instruction in the model schedule to be added.
	(debug_ready_list): Print the INSN_REG_PRESSURE_EXCESS_COST_CHANGE
	and delay for SCHED_PRESSURE_MODEL too.
	(prune_ready_list): Extend SCHED_PRIORITY_WEIGHTED handling to
	SCHED_PRIORITY_MODEL, but also take the DFA into account.
	(schedule_block): Call model_start_schedule and model_end_schedule.
	Extend SCHED_PRIORITY_WEIGHTED stall handling to SCHED_PRIORITY_MODEL.
	(sched_init): Extend INSN_REG_PRESSURE_EXCESS_COST_CHANGE handling
	to SCHED_PRESSURE_MODEL, but don't allocate saved_reg_live or
	region_ref_regs.
	(sched_finish): Update accordingly.
	(fix_tick_ready): Extend INSN_REG_PRESSURE_EXCESS_COST_CHANGE handling
	to SCHED_PRESSURE_MODEL.
	(add_jump_dependencies): Update call to dep_list_size.
	(haifa_finish_h_i_d): Fix leak of max_reg_pressure.
	(haifa_init_insn): Extend INSN_REG_PRESSURE_EXCESS_COST_CHANGE handling
	to SCHED_PRESSURE_MODEL.
	* sched-deps.c (init_insn_reg_pressure_info): Likewise, but don't
	allocate INSN_MAX_REG_PRESSURE for SCHED_PRESSURE_MODEL.
	(sched_analyze_insn): Extend INSN_REG_PRESSURE_EXCESS_COST_CHANGE
	handling to SCHED_PRESSURE_MODEL.

From-SVN: r186882
2012-04-26 15:49:30 +00:00
Richard Sandiford 60867e8c63 common.opt (fsched-pressure-algorithm=): New option.
gcc/
	* common.opt (fsched-pressure-algorithm=): New option.
	* flag-types.h (sched_pressure_algorithm): New enum.
	* sched-int.h (sched_pressure_p): Replace with...
	(sched_pressure): ...this new variable.
	* haifa-sched.c (sched_pressure_p): Replace with...
	(sched_pressure): ...this new variable.
	(sched_regno_pressure_class, rank_for_schedule, ready_sort)
	(update_reg_and_insn_max_reg_pressure, schedule_insn)
	(debug_ready_list, prune_ready_list, schedule_block, sched_init)
	(sched_finish, fix_tick_ready, haifa_init_insn): Update accordingly.
	* sched-deps.c (init_insn_reg_pressure_info): Likewise.
	(sched_analyze_insn): Likewise.
	* sched-rgn.c (schedule_region): Likewise.
	* config/m68k/m68k.c (m68k_sched_variable_issue): Likewise.

From-SVN: r186881
2012-04-26 15:49:13 +00:00
Janis Johnson 2b3ecd379c bf-ms-layout.c: Adjust offsets to fit ms-bitfield structure layout.
* gcc.dg/bf-ms-layout.c: Adjust offsets to fit ms-bitfield
	structure layout.

From-SVN: r186880
2012-04-26 15:16:16 +00:00
Bernd Schmidt e90247f8ba re PR middle-end/52940 (conversion from MODE_PARTIAL_INT uses sign extension for unsigned types)
PR middle-end/52940
	* machmode.h (CLASS_HAS_WIDER_MODES_P): True for MODE_PARTIAL_INT.
	* expr.c (convert_move): Honor unsignedp when extending partial int
	modes.
	* genmodes.c (complete_mode): Don't clear component field of partial
	int modes.
	(emit_mode_inner): Don't emit it however.
	(calc_wider_mode): Partial int modes widen to their component.

From-SVN: r186877
2012-04-26 14:20:39 +00:00