[Bug c/60350] Incorrect -Wmaybe-uninitialized warning with incorrect location information

2014-02-26 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60350

Andrew Pinski pinskia at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||diagnostic
   Severity|normal  |minor

--- Comment #1 from Andrew Pinski pinskia at gcc dot gnu.org ---
2) The column numbers of the two warnings point to the same location :, 
which is not right. 

This is most likely due to the casting which is added by the triany operator.


[Bug c/60350] New: Incorrect -Wmaybe-uninitialized warning with incorrect location information

2014-02-26 Thread chengniansun at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60350

Bug ID: 60350
   Summary: Incorrect -Wmaybe-uninitialized warning with incorrect
location information
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com

Two questions regarding the following case
1) the variables pf and pv are uninitialized, but not maybe-uninitialized.
I am not sure whether this is the design choice of gcc. 

2) The column numbers of the two warnings point to the same location :, which
is not right. 


$: cat s.c 
void a(int i) {
  int (*pf)[2];
  int (*pv)[i + 1];
  (i ? pf : pv);
}
$: gcc-trunk -Wuninitialized -c s.c 
s.c: In function ‘a’:
s.c:4:11: warning: ‘pf’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
   (i ? pf : pv);
   ^
s.c:4:11: warning: ‘pv’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
$: gcc-trunk --version
gcc-trunk (GCC) 4.9.0 20140226 (experimental)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[Bug target/60071] [4.9 Regression] [SH] internal compiler error: in final_scan_insn, at final.c:2963

2014-02-26 Thread kkojima at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60071

--- Comment #7 from Kazumoto Kojima kkojima at gcc dot gnu.org ---
A testresult with the patch in #6 on sh4-unknown-linux-gnu:
http://gcc.gnu.org/ml/gcc-testresults/2014-02/msg01866.html


[Bug c/60351] New: Incorrect column number for warning on right shift count is negative

2014-02-26 Thread chengniansun at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60351

Bug ID: 60351
   Summary: Incorrect column number for warning on right shift
count is negative
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chengniansun at gmail dot com

$: cat s.c 
void g(int);
void f(void) {
int i = 1;
g(  i-1);
}
$: gcc-trunk -c s.c 
s.c: In function ‘f’:
s.c:4:2: warning: right shift count is negative
  g(  i-1);
  ^
$:

[Bug libgcc/60247] AVR ATxmega C++ constructor startup in libgcc.S causes boot loop

2014-02-26 Thread bobf at mrp3 dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60247

bobf at mrp3 dot com changed:

   What|Removed |Added

   See Also||http://gcc.gnu.org/bugzilla
   ||/show_bug.cgi?id=45263

--- Comment #1 from bobf at mrp3 dot com ---
bug 45263 may be related (and has been resolved).  Preserving registers may
still be necessary, however, depending on what happens inside the constructors.


[Bug bootstrap/53902] make install fails on SunOS 5.11

2014-02-26 Thread richlowe at richlowe dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53902

Rich Lowe richlowe at richlowe dot net changed:

   What|Removed |Added

 CC||richlowe at richlowe dot net

--- Comment #7 from Rich Lowe richlowe at richlowe dot net ---
I'm pretty sure this is a result of using an older binutils.  As best as I can
tell, s11 shipped with 2.19, and s11u1 with 2.21.  I know that 2.19 will fail
in this manner, and that 2.22 appears to work.  I have not personally tried
2.21


[Bug c++/60352] New: [C++11] Bogus error: conflicting declaration 'auto i'

2014-02-26 Thread ppluzhnikov at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60352

Bug ID: 60352
   Summary: [C++11] Bogus error: conflicting declaration 'auto
i'
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ppluzhnikov at google dot com

Using current trunk (r208191):

g++ -c t.cc  -std=c++11
t.cc:2:6: error: conflicting declaration 'auto i'
 auto i = j;
  ^
t.cc:1:12: note: previous declaration as 'int i'
 extern int i, j;
^

Test:

extern int i, j;
auto i = j;


Google ref: b/13213433


[Bug debug/57232] wcstol.c:213:1: internal compiler error

2014-02-26 Thread aoliva at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57232

Alexandre Oliva aoliva at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed|2013-05-10 00:00:00 |2014-02-27
  Component|target  |debug
 Ever confirmed|0   |1

--- Comment #19 from Alexandre Oliva aoliva at gcc dot gnu.org ---
Adjusting component before posting patch to gcc-patches.


[Bug c++/58678] [4.9 Regression] pykde4-4.11.2 link error (devirtualization too trigger happy)

2014-02-26 Thread jason at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58678

--- Comment #17 from Jason Merrill jason at gcc dot gnu.org ---
(In reply to Markus Trippelsdorf from comment #0)
 class A {
 public:
   virtual ~A();
 };
 class B : A {
   virtual int m_fn1();
 };
 void fn1() {
   delete reinterpret_castB*(1);
 }

I don't understand how this could be devirtualized, since there is no actual B
object.  But this is beside the point.

In general I agree with you: there's a fundamental problem here with
devirtualization knowing which function to call vs. that function being hidden
in another DSO.  Client code has no way to know whether the library was built
with -fvisibility=hidden.

I think we want to add a GCC flag to force more conservative assumptions about
visibility, i.e. that we can't refer to anything that might not be defined in
the current object, and KDE programs could use that flag.  Perhaps we should
even make it the default in non-LTO mode.


[Bug libstdc++/52015] std::to_string does not work under MinGW

2014-02-26 Thread roman.vasiliev at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52015

--- Comment #37 from Roman roman.vasiliev at gmail dot com ---
Created attachment 32220
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=32220action=edit
initilal file


[Bug c++/60353] New: [4.9 Regression] Firefox build failure #3 caused by r208157

2014-02-26 Thread trippels at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60353

Bug ID: 60353
   Summary: [4.9 Regression] Firefox build failure #3 caused by
r208157
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: trippels at gcc dot gnu.org
CC: jason at gcc dot gnu.org

r208157 causes:

markus@x4 skia % cat test.ii
struct A {
  A(int);
};
typedef struct {
  A format;
} B;

markus@x4 skia % g++ -std=c++11 -c test.ii
test.ii: In constructor ‘B::B()’:
test.ii:6:3: error: no matching function for call to ‘A::A()’
 } B;
   ^
test.ii:6:3: note: candidates are:
test.ii:2:3: note: A::A(int)
   A(int);
   ^
test.ii:2:3: note:   candidate expects 1 argument, 0 provided
test.ii:1:8: note: constexpr A::A(const A)
 struct A {
^
test.ii:1:8: note:   candidate expects 1 argument, 0 provided
test.ii:1:8: note: constexpr A::A(A)
test.ii:1:8: note:   candidate expects 1 argument, 0 provided
test.ii: At global scope:
test.ii:4:16: note: synthesized method ‘B::B()’ first required here 
 typedef struct {
^

[Bug libstdc++/52015] std::to_string does not work under MinGW

2014-02-26 Thread roman.vasiliev at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52015

--- Comment #38 from Roman roman.vasiliev at gmail dot com ---
Created attachment 32221
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=32221action=edit
yeld without -std=c++11


[Bug libstdc++/52015] std::to_string does not work under MinGW

2014-02-26 Thread roman.vasiliev at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52015

--- Comment #39 from Roman roman.vasiliev at gmail dot com ---
Created attachment 3
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=3action=edit
yeld with -std=c++11


[Bug libstdc++/52015] std::to_string does not work under MinGW

2014-02-26 Thread roman.vasiliev at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52015

--- Comment #40 from Roman roman.vasiliev at gmail dot com ---
(In reply to Jonathan Wakely from comment #36)
 (In reply to Roman from comment #35)
  Tried to apply proposed patch for MinGW 4.8.1 and received no positive
  effect. Compiler tells about error : 'stoi' was not declared in this scope.
  Have any Idea how to fix it?
 
 Not enough information to be useful.
 
 Did you even use -std=c++11 ? 
Yes, shure.
 
 Noone here can debug your modified sources, you'll have to look into what is
 or isn't defined on your system after the patch. Try looking at the
 preprocessed source, for example.
I'm not familiar with such a matter. Attached files are:
stoi.cpp is initial code
stoi_prep.cpp is result of g++ stoi.cpp -E  stoi_prep.cpp
stoi_prep11.cpp is result of g++ stoi.cpp -E -std=c++11  stoi_prep11.cpp


[Bug middle-end/48784] #pragma pack(1) + -fstrict-volatile-bitfields = bad codegen

2014-02-26 Thread jye2 at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48784

--- Comment #7 from jye2 at gcc dot gnu.org ---
Author: jye2
Date: Thu Feb 27 07:28:06 2014
New Revision: 208195

URL: http://gcc.gnu.org/viewcvs?rev=208195root=gccview=rev
Log:
2014-02-27  Joey Ye  joey...@arm.com

Backport mainline strict-volatile-bitfields fixes
2013-09-28  Sandra Loosemore  san...@codesourcery.com

gcc/
* expr.h (extract_bit_field): Remove packedp parameter.
* expmed.c (extract_fixed_bit_field): Remove packedp parameter
from forward declaration.
(store_split_bit_field): Remove packedp arg from calls to
extract_fixed_bit_field.
(extract_bit_field_1): Remove packedp parameter and packedp
argument from recursive calls and calls to extract_fixed_bit_field.
(extract_bit_field): Remove packedp parameter and corresponding
arg to extract_bit_field_1.
(extract_fixed_bit_field): Remove packedp parameter.  Remove code
to issue warnings.
(extract_split_bit_field): Remove packedp arg from call to
extract_fixed_bit_field.
* expr.c (emit_group_load_1): Adjust calls to extract_bit_field.
(copy_blkmode_from_reg): Likewise.
(copy_blkmode_to_reg): Likewise.
(read_complex_part): Likewise.
(store_field): Likewise.
(expand_expr_real_1): Likewise.
* calls.c (store_unaligned_arguments_into_pseudos): Adjust call
to extract_bit_field.
* config/tilegx/tilegx.c (tilegx_expand_unaligned_load): Adjust
call to extract_bit_field.
* config/tilepro/tilepro.c (tilepro_expand_unaligned_load): Adjust
call to extract_bit_field.
* doc/invoke.texi (Code Gen Options): Remove mention of warnings
and special packedp behavior from -fstrict-volatile-bitfields
documentation.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de

* expr.c (expand_assignment): Remove dependency on 
flag_strict_volatile_bitfields. Always set the memory
access mode.
(expand_expr_real_1): Likewise.

2013-12-11  Sandra Loosemore  san...@codesourcery.com

PR middle-end/23623
PR middle-end/48784
PR middle-end/56341
PR middle-end/56997

gcc/
* expmed.c (strict_volatile_bitfield_p): New function.
(store_bit_field_1): Don't special-case strict volatile
bitfields here.
(store_bit_field): Handle strict volatile bitfields here instead.
(store_fixed_bit_field): Don't special-case strict volatile
bitfields here.
(extract_bit_field_1): Don't special-case strict volatile
bitfields here.
(extract_bit_field): Handle strict volatile bitfields here instead.
(extract_fixed_bit_field): Don't special-case strict volatile
bitfields here.  Simplify surrounding code to resemble that in
store_fixed_bit_field.
* doc/invoke.texi (Code Gen Options): Update
-fstrict-volatile-bitfields description.

gcc/testsuite/
* gcc.dg/pr23623.c: New test.
* gcc.dg/pr48784-1.c: New test.
* gcc.dg/pr48784-2.c: New test.
* gcc.dg/pr56341-1.c: New test.
* gcc.dg/pr56341-2.c: New test.
* gcc.dg/pr56997-1.c: New test.
* gcc.dg/pr56997-2.c: New test.
* gcc.dg/pr56997-3.c: New test.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de
 Sandra Loosemore  san...@codesourcery.com

PR middle-end/23623
PR middle-end/48784
PR middle-end/56341
PR middle-end/56997
* expmed.c (strict_volatile_bitfield_p): Add bitregion_start
and bitregion_end parameters.  Test for compliance with C++
memory model.
(store_bit_field): Adjust call to strict_volatile_bitfield_p.
Add fallback logic for cases where -fstrict-volatile-bitfields
is supposed to apply, but cannot.
(extract_bit_field): Likewise. Use narrow_bit_field_mem and
extract_fixed_bit_field_1 to do the extraction.
(extract_fixed_bit_field): Revert to previous mode selection
algorithm.
Call extract_fixed_bit_field_1 to do the real work.
(extract_fixed_bit_field_1): New function.

testsuite:
* gcc.dg/pr23623.c: Update to test interaction with C++
memory model.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de

PR middle-end/59134
* expmed.c (store_bit_field): Use narrow_bit_field_mem and
store_fixed_bit_field_1 for -fstrict-volatile-bitfields.
(store_fixed_bit_field): Split up.  Call store_fixed_bit_field_1
to do the real work.
(store_fixed_bit_field_1): New function. 
(store_split_bit_field): Limit the unit size to the memory mode
size,
to prevent recursion.

testsuite:
* gcc.c-torture/compile/pr59134.c: New test.
* gnat.dg/misaligned_volatile.adb: New test.

Added:
   

[Bug middle-end/56341] GCC produces unaligned data access

2014-02-26 Thread jye2 at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56341

--- Comment #18 from jye2 at gcc dot gnu.org ---
Author: jye2
Date: Thu Feb 27 07:28:06 2014
New Revision: 208195

URL: http://gcc.gnu.org/viewcvs?rev=208195root=gccview=rev
Log:
2014-02-27  Joey Ye  joey...@arm.com

Backport mainline strict-volatile-bitfields fixes
2013-09-28  Sandra Loosemore  san...@codesourcery.com

gcc/
* expr.h (extract_bit_field): Remove packedp parameter.
* expmed.c (extract_fixed_bit_field): Remove packedp parameter
from forward declaration.
(store_split_bit_field): Remove packedp arg from calls to
extract_fixed_bit_field.
(extract_bit_field_1): Remove packedp parameter and packedp
argument from recursive calls and calls to extract_fixed_bit_field.
(extract_bit_field): Remove packedp parameter and corresponding
arg to extract_bit_field_1.
(extract_fixed_bit_field): Remove packedp parameter.  Remove code
to issue warnings.
(extract_split_bit_field): Remove packedp arg from call to
extract_fixed_bit_field.
* expr.c (emit_group_load_1): Adjust calls to extract_bit_field.
(copy_blkmode_from_reg): Likewise.
(copy_blkmode_to_reg): Likewise.
(read_complex_part): Likewise.
(store_field): Likewise.
(expand_expr_real_1): Likewise.
* calls.c (store_unaligned_arguments_into_pseudos): Adjust call
to extract_bit_field.
* config/tilegx/tilegx.c (tilegx_expand_unaligned_load): Adjust
call to extract_bit_field.
* config/tilepro/tilepro.c (tilepro_expand_unaligned_load): Adjust
call to extract_bit_field.
* doc/invoke.texi (Code Gen Options): Remove mention of warnings
and special packedp behavior from -fstrict-volatile-bitfields
documentation.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de

* expr.c (expand_assignment): Remove dependency on 
flag_strict_volatile_bitfields. Always set the memory
access mode.
(expand_expr_real_1): Likewise.

2013-12-11  Sandra Loosemore  san...@codesourcery.com

PR middle-end/23623
PR middle-end/48784
PR middle-end/56341
PR middle-end/56997

gcc/
* expmed.c (strict_volatile_bitfield_p): New function.
(store_bit_field_1): Don't special-case strict volatile
bitfields here.
(store_bit_field): Handle strict volatile bitfields here instead.
(store_fixed_bit_field): Don't special-case strict volatile
bitfields here.
(extract_bit_field_1): Don't special-case strict volatile
bitfields here.
(extract_bit_field): Handle strict volatile bitfields here instead.
(extract_fixed_bit_field): Don't special-case strict volatile
bitfields here.  Simplify surrounding code to resemble that in
store_fixed_bit_field.
* doc/invoke.texi (Code Gen Options): Update
-fstrict-volatile-bitfields description.

gcc/testsuite/
* gcc.dg/pr23623.c: New test.
* gcc.dg/pr48784-1.c: New test.
* gcc.dg/pr48784-2.c: New test.
* gcc.dg/pr56341-1.c: New test.
* gcc.dg/pr56341-2.c: New test.
* gcc.dg/pr56997-1.c: New test.
* gcc.dg/pr56997-2.c: New test.
* gcc.dg/pr56997-3.c: New test.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de
 Sandra Loosemore  san...@codesourcery.com

PR middle-end/23623
PR middle-end/48784
PR middle-end/56341
PR middle-end/56997
* expmed.c (strict_volatile_bitfield_p): Add bitregion_start
and bitregion_end parameters.  Test for compliance with C++
memory model.
(store_bit_field): Adjust call to strict_volatile_bitfield_p.
Add fallback logic for cases where -fstrict-volatile-bitfields
is supposed to apply, but cannot.
(extract_bit_field): Likewise. Use narrow_bit_field_mem and
extract_fixed_bit_field_1 to do the extraction.
(extract_fixed_bit_field): Revert to previous mode selection
algorithm.
Call extract_fixed_bit_field_1 to do the real work.
(extract_fixed_bit_field_1): New function.

testsuite:
* gcc.dg/pr23623.c: Update to test interaction with C++
memory model.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de

PR middle-end/59134
* expmed.c (store_bit_field): Use narrow_bit_field_mem and
store_fixed_bit_field_1 for -fstrict-volatile-bitfields.
(store_fixed_bit_field): Split up.  Call store_fixed_bit_field_1
to do the real work.
(store_fixed_bit_field_1): New function. 
(store_split_bit_field): Limit the unit size to the memory mode
size,
to prevent recursion.

testsuite:
* gcc.c-torture/compile/pr59134.c: New test.
* gnat.dg/misaligned_volatile.adb: New test.

Added:
   

[Bug middle-end/59134] [4.7/4.8/4.9 regression] infinite loop between store_fixed_bit_field and store_split_bit_field with STRICT_ALIGNMENT

2014-02-26 Thread jye2 at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59134

--- Comment #7 from jye2 at gcc dot gnu.org ---
Author: jye2
Date: Thu Feb 27 07:28:06 2014
New Revision: 208195

URL: http://gcc.gnu.org/viewcvs?rev=208195root=gccview=rev
Log:
2014-02-27  Joey Ye  joey...@arm.com

Backport mainline strict-volatile-bitfields fixes
2013-09-28  Sandra Loosemore  san...@codesourcery.com

gcc/
* expr.h (extract_bit_field): Remove packedp parameter.
* expmed.c (extract_fixed_bit_field): Remove packedp parameter
from forward declaration.
(store_split_bit_field): Remove packedp arg from calls to
extract_fixed_bit_field.
(extract_bit_field_1): Remove packedp parameter and packedp
argument from recursive calls and calls to extract_fixed_bit_field.
(extract_bit_field): Remove packedp parameter and corresponding
arg to extract_bit_field_1.
(extract_fixed_bit_field): Remove packedp parameter.  Remove code
to issue warnings.
(extract_split_bit_field): Remove packedp arg from call to
extract_fixed_bit_field.
* expr.c (emit_group_load_1): Adjust calls to extract_bit_field.
(copy_blkmode_from_reg): Likewise.
(copy_blkmode_to_reg): Likewise.
(read_complex_part): Likewise.
(store_field): Likewise.
(expand_expr_real_1): Likewise.
* calls.c (store_unaligned_arguments_into_pseudos): Adjust call
to extract_bit_field.
* config/tilegx/tilegx.c (tilegx_expand_unaligned_load): Adjust
call to extract_bit_field.
* config/tilepro/tilepro.c (tilepro_expand_unaligned_load): Adjust
call to extract_bit_field.
* doc/invoke.texi (Code Gen Options): Remove mention of warnings
and special packedp behavior from -fstrict-volatile-bitfields
documentation.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de

* expr.c (expand_assignment): Remove dependency on 
flag_strict_volatile_bitfields. Always set the memory
access mode.
(expand_expr_real_1): Likewise.

2013-12-11  Sandra Loosemore  san...@codesourcery.com

PR middle-end/23623
PR middle-end/48784
PR middle-end/56341
PR middle-end/56997

gcc/
* expmed.c (strict_volatile_bitfield_p): New function.
(store_bit_field_1): Don't special-case strict volatile
bitfields here.
(store_bit_field): Handle strict volatile bitfields here instead.
(store_fixed_bit_field): Don't special-case strict volatile
bitfields here.
(extract_bit_field_1): Don't special-case strict volatile
bitfields here.
(extract_bit_field): Handle strict volatile bitfields here instead.
(extract_fixed_bit_field): Don't special-case strict volatile
bitfields here.  Simplify surrounding code to resemble that in
store_fixed_bit_field.
* doc/invoke.texi (Code Gen Options): Update
-fstrict-volatile-bitfields description.

gcc/testsuite/
* gcc.dg/pr23623.c: New test.
* gcc.dg/pr48784-1.c: New test.
* gcc.dg/pr48784-2.c: New test.
* gcc.dg/pr56341-1.c: New test.
* gcc.dg/pr56341-2.c: New test.
* gcc.dg/pr56997-1.c: New test.
* gcc.dg/pr56997-2.c: New test.
* gcc.dg/pr56997-3.c: New test.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de
 Sandra Loosemore  san...@codesourcery.com

PR middle-end/23623
PR middle-end/48784
PR middle-end/56341
PR middle-end/56997
* expmed.c (strict_volatile_bitfield_p): Add bitregion_start
and bitregion_end parameters.  Test for compliance with C++
memory model.
(store_bit_field): Adjust call to strict_volatile_bitfield_p.
Add fallback logic for cases where -fstrict-volatile-bitfields
is supposed to apply, but cannot.
(extract_bit_field): Likewise. Use narrow_bit_field_mem and
extract_fixed_bit_field_1 to do the extraction.
(extract_fixed_bit_field): Revert to previous mode selection
algorithm.
Call extract_fixed_bit_field_1 to do the real work.
(extract_fixed_bit_field_1): New function.

testsuite:
* gcc.dg/pr23623.c: Update to test interaction with C++
memory model.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de

PR middle-end/59134
* expmed.c (store_bit_field): Use narrow_bit_field_mem and
store_fixed_bit_field_1 for -fstrict-volatile-bitfields.
(store_fixed_bit_field): Split up.  Call store_fixed_bit_field_1
to do the real work.
(store_fixed_bit_field_1): New function. 
(store_split_bit_field): Limit the unit size to the memory mode
size,
to prevent recursion.

testsuite:
* gcc.c-torture/compile/pr59134.c: New test.
* gnat.dg/misaligned_volatile.adb: New test.

Added:
   

[Bug target/56997] Incorrect write to packed field when strict-volatile-bitfields enabled on aarch32

2014-02-26 Thread jye2 at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56997

--- Comment #15 from jye2 at gcc dot gnu.org ---
Author: jye2
Date: Thu Feb 27 07:28:06 2014
New Revision: 208195

URL: http://gcc.gnu.org/viewcvs?rev=208195root=gccview=rev
Log:
2014-02-27  Joey Ye  joey...@arm.com

Backport mainline strict-volatile-bitfields fixes
2013-09-28  Sandra Loosemore  san...@codesourcery.com

gcc/
* expr.h (extract_bit_field): Remove packedp parameter.
* expmed.c (extract_fixed_bit_field): Remove packedp parameter
from forward declaration.
(store_split_bit_field): Remove packedp arg from calls to
extract_fixed_bit_field.
(extract_bit_field_1): Remove packedp parameter and packedp
argument from recursive calls and calls to extract_fixed_bit_field.
(extract_bit_field): Remove packedp parameter and corresponding
arg to extract_bit_field_1.
(extract_fixed_bit_field): Remove packedp parameter.  Remove code
to issue warnings.
(extract_split_bit_field): Remove packedp arg from call to
extract_fixed_bit_field.
* expr.c (emit_group_load_1): Adjust calls to extract_bit_field.
(copy_blkmode_from_reg): Likewise.
(copy_blkmode_to_reg): Likewise.
(read_complex_part): Likewise.
(store_field): Likewise.
(expand_expr_real_1): Likewise.
* calls.c (store_unaligned_arguments_into_pseudos): Adjust call
to extract_bit_field.
* config/tilegx/tilegx.c (tilegx_expand_unaligned_load): Adjust
call to extract_bit_field.
* config/tilepro/tilepro.c (tilepro_expand_unaligned_load): Adjust
call to extract_bit_field.
* doc/invoke.texi (Code Gen Options): Remove mention of warnings
and special packedp behavior from -fstrict-volatile-bitfields
documentation.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de

* expr.c (expand_assignment): Remove dependency on 
flag_strict_volatile_bitfields. Always set the memory
access mode.
(expand_expr_real_1): Likewise.

2013-12-11  Sandra Loosemore  san...@codesourcery.com

PR middle-end/23623
PR middle-end/48784
PR middle-end/56341
PR middle-end/56997

gcc/
* expmed.c (strict_volatile_bitfield_p): New function.
(store_bit_field_1): Don't special-case strict volatile
bitfields here.
(store_bit_field): Handle strict volatile bitfields here instead.
(store_fixed_bit_field): Don't special-case strict volatile
bitfields here.
(extract_bit_field_1): Don't special-case strict volatile
bitfields here.
(extract_bit_field): Handle strict volatile bitfields here instead.
(extract_fixed_bit_field): Don't special-case strict volatile
bitfields here.  Simplify surrounding code to resemble that in
store_fixed_bit_field.
* doc/invoke.texi (Code Gen Options): Update
-fstrict-volatile-bitfields description.

gcc/testsuite/
* gcc.dg/pr23623.c: New test.
* gcc.dg/pr48784-1.c: New test.
* gcc.dg/pr48784-2.c: New test.
* gcc.dg/pr56341-1.c: New test.
* gcc.dg/pr56341-2.c: New test.
* gcc.dg/pr56997-1.c: New test.
* gcc.dg/pr56997-2.c: New test.
* gcc.dg/pr56997-3.c: New test.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de
 Sandra Loosemore  san...@codesourcery.com

PR middle-end/23623
PR middle-end/48784
PR middle-end/56341
PR middle-end/56997
* expmed.c (strict_volatile_bitfield_p): Add bitregion_start
and bitregion_end parameters.  Test for compliance with C++
memory model.
(store_bit_field): Adjust call to strict_volatile_bitfield_p.
Add fallback logic for cases where -fstrict-volatile-bitfields
is supposed to apply, but cannot.
(extract_bit_field): Likewise. Use narrow_bit_field_mem and
extract_fixed_bit_field_1 to do the extraction.
(extract_fixed_bit_field): Revert to previous mode selection
algorithm.
Call extract_fixed_bit_field_1 to do the real work.
(extract_fixed_bit_field_1): New function.

testsuite:
* gcc.dg/pr23623.c: Update to test interaction with C++
memory model.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de

PR middle-end/59134
* expmed.c (store_bit_field): Use narrow_bit_field_mem and
store_fixed_bit_field_1 for -fstrict-volatile-bitfields.
(store_fixed_bit_field): Split up.  Call store_fixed_bit_field_1
to do the real work.
(store_fixed_bit_field_1): New function. 
(store_split_bit_field): Limit the unit size to the memory mode
size,
to prevent recursion.

testsuite:
* gcc.c-torture/compile/pr59134.c: New test.
* gnat.dg/misaligned_volatile.adb: New test.

Added:
   

[Bug middle-end/23623] volatile keyword changes bitfield access size from 32bit to 8bit

2014-02-26 Thread jye2 at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23623

--- Comment #20 from jye2 at gcc dot gnu.org ---
Author: jye2
Date: Thu Feb 27 07:28:06 2014
New Revision: 208195

URL: http://gcc.gnu.org/viewcvs?rev=208195root=gccview=rev
Log:
2014-02-27  Joey Ye  joey...@arm.com

Backport mainline strict-volatile-bitfields fixes
2013-09-28  Sandra Loosemore  san...@codesourcery.com

gcc/
* expr.h (extract_bit_field): Remove packedp parameter.
* expmed.c (extract_fixed_bit_field): Remove packedp parameter
from forward declaration.
(store_split_bit_field): Remove packedp arg from calls to
extract_fixed_bit_field.
(extract_bit_field_1): Remove packedp parameter and packedp
argument from recursive calls and calls to extract_fixed_bit_field.
(extract_bit_field): Remove packedp parameter and corresponding
arg to extract_bit_field_1.
(extract_fixed_bit_field): Remove packedp parameter.  Remove code
to issue warnings.
(extract_split_bit_field): Remove packedp arg from call to
extract_fixed_bit_field.
* expr.c (emit_group_load_1): Adjust calls to extract_bit_field.
(copy_blkmode_from_reg): Likewise.
(copy_blkmode_to_reg): Likewise.
(read_complex_part): Likewise.
(store_field): Likewise.
(expand_expr_real_1): Likewise.
* calls.c (store_unaligned_arguments_into_pseudos): Adjust call
to extract_bit_field.
* config/tilegx/tilegx.c (tilegx_expand_unaligned_load): Adjust
call to extract_bit_field.
* config/tilepro/tilepro.c (tilepro_expand_unaligned_load): Adjust
call to extract_bit_field.
* doc/invoke.texi (Code Gen Options): Remove mention of warnings
and special packedp behavior from -fstrict-volatile-bitfields
documentation.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de

* expr.c (expand_assignment): Remove dependency on 
flag_strict_volatile_bitfields. Always set the memory
access mode.
(expand_expr_real_1): Likewise.

2013-12-11  Sandra Loosemore  san...@codesourcery.com

PR middle-end/23623
PR middle-end/48784
PR middle-end/56341
PR middle-end/56997

gcc/
* expmed.c (strict_volatile_bitfield_p): New function.
(store_bit_field_1): Don't special-case strict volatile
bitfields here.
(store_bit_field): Handle strict volatile bitfields here instead.
(store_fixed_bit_field): Don't special-case strict volatile
bitfields here.
(extract_bit_field_1): Don't special-case strict volatile
bitfields here.
(extract_bit_field): Handle strict volatile bitfields here instead.
(extract_fixed_bit_field): Don't special-case strict volatile
bitfields here.  Simplify surrounding code to resemble that in
store_fixed_bit_field.
* doc/invoke.texi (Code Gen Options): Update
-fstrict-volatile-bitfields description.

gcc/testsuite/
* gcc.dg/pr23623.c: New test.
* gcc.dg/pr48784-1.c: New test.
* gcc.dg/pr48784-2.c: New test.
* gcc.dg/pr56341-1.c: New test.
* gcc.dg/pr56341-2.c: New test.
* gcc.dg/pr56997-1.c: New test.
* gcc.dg/pr56997-2.c: New test.
* gcc.dg/pr56997-3.c: New test.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de
 Sandra Loosemore  san...@codesourcery.com

PR middle-end/23623
PR middle-end/48784
PR middle-end/56341
PR middle-end/56997
* expmed.c (strict_volatile_bitfield_p): Add bitregion_start
and bitregion_end parameters.  Test for compliance with C++
memory model.
(store_bit_field): Adjust call to strict_volatile_bitfield_p.
Add fallback logic for cases where -fstrict-volatile-bitfields
is supposed to apply, but cannot.
(extract_bit_field): Likewise. Use narrow_bit_field_mem and
extract_fixed_bit_field_1 to do the extraction.
(extract_fixed_bit_field): Revert to previous mode selection
algorithm.
Call extract_fixed_bit_field_1 to do the real work.
(extract_fixed_bit_field_1): New function.

testsuite:
* gcc.dg/pr23623.c: Update to test interaction with C++
memory model.

2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de

PR middle-end/59134
* expmed.c (store_bit_field): Use narrow_bit_field_mem and
store_fixed_bit_field_1 for -fstrict-volatile-bitfields.
(store_fixed_bit_field): Split up.  Call store_fixed_bit_field_1
to do the real work.
(store_fixed_bit_field_1): New function. 
(store_split_bit_field): Limit the unit size to the memory mode
size,
to prevent recursion.

testsuite:
* gcc.c-torture/compile/pr59134.c: New test.
* gnat.dg/misaligned_volatile.adb: New test.

Added:
   

[Bug c/60351] Incorrect column number for warning on right shift count is negative

2014-02-26 Thread mpolacek at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60351

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2014-02-27
 CC||mpolacek at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek mpolacek at gcc dot gnu.org ---
Mine.


[Bug middle-end/60350] Incorrect -Wmaybe-uninitialized warning with incorrect location information

2014-02-26 Thread mpolacek at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60350

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2014-02-27
 CC||mpolacek at gcc dot gnu.org
  Component|c   |middle-end
 Ever confirmed|0   |1

--- Comment #2 from Marek Polacek mpolacek at gcc dot gnu.org ---
I think the maybe-used-uninitialized warning is in place here, it depends on I
whether pf or pv is evaluated.  The column info looks bogus indeed.


Re: [PATCH] Fix PR60327 - dealII and Xalanbmk ICEing with LTO

2014-02-26 Thread Richard Biener
On Tue, 25 Feb 2014, Jan Hubicka wrote:

  
  This fixes the ICE on our regular -flto-partition=none testers
  which sees an edge w/o call-stmt after inlining (see the PR
  for details).  I'm not sure this is supposed to happen but the
  following re-instantiates the guard to inline_update_overall_summary
  which was present before the last change to that area.
  
  LTO bootstrap / regtest running on x86_64-unknown-linux-gnu, ok?
 
  
  Thanks,
  Richard.
  
  2014-02-25  Richard Biener  rguent...@suse.de
  
  PR ipa/60327
  * ipa.c (walk_polymorphic_call_targets): Properly guard
  call to inline_update_overall_summary.
 
 Ah yes, that is OK! Indeed inline summaries are freed after inlining during
 normal compilation. During WPA they are kept so lto-partitioning can use them.

One more reason to drop -flto-partition=none (and introduce
-flto-partition=one)?  IMHO this different path through the
LTO pipeline is not worth maintaining.

Richard.


Re: [Patch, GCC/ARM] Redefine the ASM_APP_OFF in a cleaner way

2014-02-26 Thread Ramana Radhakrishnan

On 02/26/14 01:54, Terry Guo wrote:

Hi There,

As the assembler directive .code 16 equals .thumb, this small patch is
going to redefine the ASM_APP_OFF in a cleaner way. Tested with GCC
regression test and no regressions. Is it OK to current trunk or shall we
wait until the release-branch mode end?


Ok for stage1.

regards
Ramana




Re: [v3] complex functions with expression template reals

2014-02-26 Thread Jonathan Wakely
On 24 February 2014 09:10, Paolo Carlini wrote:

 Another option would be just using boost/multiprecision/mpfr.hpp when
 available. In general, I think it makes sense to have a minimum of
 infrastructure enabling tests checking interoperability with boost. If only
 we had a check_v3_target_header { args } it would be most of it, but it
 doesn't seem we do?!? Anyway I guess we can take care of that post 4.9.0 and
 commit the straightforward code tweak now. Jon?

I'd be happy with it for Stage 1, but I don't think we should apply it
now if it is only useful for people doing unusual (unsupported) things
with std::complex.


Re: [v3] complex functions with expression template reals

2014-02-26 Thread Paolo Carlini

On 02/26/2014 10:57 AM, Jonathan Wakely wrote:

On 24 February 2014 09:10, Paolo Carlini wrote:

Another option would be just using boost/multiprecision/mpfr.hpp when
available. In general, I think it makes sense to have a minimum of
infrastructure enabling tests checking interoperability with boost. If only
we had a check_v3_target_header { args } it would be most of it, but it
doesn't seem we do?!? Anyway I guess we can take care of that post 4.9.0 and
commit the straightforward code tweak now. Jon?

I'd be happy with it for Stage 1, but I don't think we should apply it
now if it is only useful for people doing unusual (unsupported) things
with std::complex.

Ok. Marc, please remember to apply it as soon as Stage 1 re-opens.

Paolo.


[PATCH] Fix PR60343

2014-02-26 Thread Richard Biener

Bootstrapped on x86_64-unknown-linux-gnu, committed.

Richard.

2014-02-26  Richard Biener  rguent...@suse.de

PR bootstrap/60343
* lra-assigns.c (spill_for): Avoid mixed-sign comparison.

Index: gcc/lra-assigns.c
===
--- gcc/lra-assigns.c   (revision 208166)
+++ gcc/lra-assigns.c   (working copy)
@@ -898,7 +898,7 @@ spill_for (int regno, bitmap spilled_pse
}
   n = 0;
   if (sparseset_cardinality (live_range_reload_inheritance_pseudos)
- = LRA_MAX_CONSIDERED_RELOAD_PSEUDOS)
+ = (unsigned)LRA_MAX_CONSIDERED_RELOAD_PSEUDOS)
EXECUTE_IF_SET_IN_SPARSESET (live_range_reload_inheritance_pseudos,
 reload_regno)
  if ((int) reload_regno != regno


Re: [PATCH,GRAPHiTE] Fix for P1 bug 58028

2014-02-26 Thread Tobias Grosser

On 02/26/2014 03:30 PM, Mircea Namolaru wrote:

This patch fixes the libgomp problems:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58028

2014-02-26 Tobies Grosser tob...@grosser.es
Mircea Namolaru mnamo...@inria.fr


Hi Mircea,

the patch is correct.


Fix for bug 58028
* graphite-clast-to-gimple.c (set_cloog_options):
Don't remove scalar dimensions

Index: gcc/graphite-clast-to-gimple.c
===
--- gcc/graphite-clast-to-gimple.c (revision 207298)
+++ gcc/graphite-clast-to-gimple.c (working copy)
@@ -1522,6 +1522,10 @@
variables. */
options-save_domains = 1;

+ /* Don't remove scalars dimensions - original number of dimensions required
+ for loop-can_be_parallel check. */
+ options-noscalars = 1;


Maybe we can provide a little bit more information. What about the 
following:


Do not remove scalar dimensions. Cloog be default removes scalar 
dimensions very early from the input schedule. However, they are 
necessary to correctly derive from the saved domains 
(options-save_domains) the relationship between the generated loops and 
the schedule dimensions they are generated from.


As this patch fixes a regression it should be fine at this stage. 
However, let's wait for the explicit OK from a release manager.


Tobias

Btw.: Do you have commit access?




patch to fix PR60317

2014-02-26 Thread Vladimir Makarov
Sorry, my yesterday mail was lost (because of my computer freeze on 
unstable kernel).  So I am sending the email again.


Here is the patch to fix

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

The patch speeds up the compiler in 5 times on this patalogical test and 
making LRA faster reload on this test as it should be.


The patch has very minor effect on SPEC2000 (only few tests have a 
different code and there is no visible SPEC2000 rates changes).


2014-02-25  Vladimir Makarov  vmaka...@redhat.com

PR rtl-optimization/60317
* params.def (PARAM_LRA_MAX_CONSIDERED_RELOAD_PSEUDOS): New.
* params.h (LRA_MAX_CONSIDERED_RELOAD_PSEUDOS): New.
* lra-assigns.c: Include params.h.
(spill_for): Use LRA_MAX_CONSIDERED_RELOAD_PSEUDOS as guard for
other reload pseudos considerations.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 32a74a7..616d8ec 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2014-02-25  Vladimir Makarov  vmaka...@redhat.com
+
+   PR rtl-optimization/60317
+   * params.def (PARAM_LRA_MAX_CONSIDERED_RELOAD_PSEUDOS): New.
+   * params.h (LRA_MAX_CONSIDERED_RELOAD_PSEUDOS): New.
+   * lra-assigns.c: Include params.h.
+   (spill_for): Use LRA_MAX_CONSIDERED_RELOAD_PSEUDOS as guard for
+   other reload pseudos considerations.
+
 2014-02-25  Bill Schmidt  wschm...@linux.vnet.ibm.com
 
* config/rs6000/vector.md (*vector_unorderedmode): Change split
diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c
index 268edcc..f94ebe6 100644
--- a/gcc/lra-assigns.c
+++ b/gcc/lra-assigns.c
@@ -94,6 +94,7 @@ along with GCC; see the file COPYING3.If not see
 #include df.h
 #include ira.h
 #include sparseset.h
+#include params.h
 #include lra-int.h
 
 /* Array containing corresponding values of function
@@ -896,14 +897,16 @@ spill_for (int regno, bitmap spilled_pseudo_bitmap)
}
}
   n = 0;
-  EXECUTE_IF_SET_IN_SPARSESET (live_range_reload_inheritance_pseudos,
-  reload_regno)
-   if ((int) reload_regno != regno
-(ira_reg_classes_intersect_p
-   [rclass][regno_allocno_class_array[reload_regno]])
-live_pseudos_reg_renumber[reload_regno]  0
-find_hard_regno_for (reload_regno, cost, -1)  0)
- sorted_reload_pseudos[n++] = reload_regno;
+  if (sparseset_cardinality (live_range_reload_inheritance_pseudos)
+ = LRA_MAX_CONSIDERED_RELOAD_PSEUDOS)
+   EXECUTE_IF_SET_IN_SPARSESET (live_range_reload_inheritance_pseudos,
+reload_regno)
+ if ((int) reload_regno != regno
+  (ira_reg_classes_intersect_p
+ [rclass][regno_allocno_class_array[reload_regno]])
+  live_pseudos_reg_renumber[reload_regno]  0
+  find_hard_regno_for (reload_regno, cost, -1)  0)
+   sorted_reload_pseudos[n++] = reload_regno;
   EXECUTE_IF_SET_IN_BITMAP (spill_pseudos_bitmap, 0, spill_regno, bi)
{
  update_lives (spill_regno, true);
diff --git a/gcc/params.def b/gcc/params.def
index ad63a37..dd2e2cd 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -821,6 +821,11 @@ DEFPARAM (PARAM_IRA_LOOP_RESERVED_REGS,
  The number of registers in each class kept unused by loop invariant 
motion,
  2, 0, 0)
 
+DEFPARAM (PARAM_LRA_MAX_CONSIDERED_RELOAD_PSEUDOS,
+ lra-max-considered-reload-pseudos,
+ The max number of reload pseudos which are considered during 
spilling a non-reload pseudo,
+ 500, 0, 0)
+
 /* Switch initialization conversion will refuse to create arrays that are
bigger than this parameter times the number of switch branches.  */
 
diff --git a/gcc/params.h b/gcc/params.h
index 64f3a0f..0d6daa2 100644
--- a/gcc/params.h
+++ b/gcc/params.h
@@ -196,6 +196,8 @@ extern void init_param_values (int *params);
   PARAM_VALUE (PARAM_IRA_MAX_CONFLICT_TABLE_SIZE)
 #define IRA_LOOP_RESERVED_REGS \
   PARAM_VALUE (PARAM_IRA_LOOP_RESERVED_REGS)
+#define LRA_MAX_CONSIDERED_RELOAD_PSEUDOS \
+  PARAM_VALUE (PARAM_LRA_MAX_CONSIDERED_RELOAD_PSEUDOS)
 #define SWITCH_CONVERSION_BRANCH_RATIO \
   PARAM_VALUE (PARAM_SWITCH_CONVERSION_BRANCH_RATIO)
 #define LOOP_INVARIANT_MAX_BBS_IN_LOOP \


[PATCH][AArch64] Use Cortex-A57 rtx costs for the generic CPU

2014-02-26 Thread Kyrill Tkachov

Hi all,

The generic rtx cost table was written with AArch32 cores in mind. It would be a 
better idea to use the Cortex-A57 costs for the generic CPU in aarch64. That way 
we schedule for the Cortex-A53 and do instruction selection for the Cortex-A57.


Since generic is the default CPU, this patch can change default code generation 
but is highly unlikely to affect correctness (unless it exposes latent bugs) 
since it only affects instruction selection.


Tested aarch64-none-elf on a model with no regressions.

Is it ok for trunk now or shall we wait for stage1?

Thanks,
Kyrill

2014-02-26  Kyrylo Tkachov  kyrylo.tkac...@arm.com

* config/aarch64/aarch64.c (generic_tunings):
Use cortexa57_extra_costs.diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index ea90311..b5a2fe1 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -217,7 +217,7 @@ __extension__
 #endif
 static const struct tune_params generic_tunings =
 {
-  generic_extra_costs,
+  cortexa57_extra_costs,
   generic_addrcost_table,
   generic_regmove_cost,
   generic_vector_cost,

Re: [RS6000, patch] pr57936, ICE in rs6000_secondary_reload_inner

2014-02-26 Thread Ulrich Weigand
Alan Modra wrote:

 Some notes:  Setting old to rl-in_reg when it is a subreg doesn't
 change the cases where delete_output_reload is called, since that call
 is protected by REG_P (old).  The same thing goes for the following:
 
   /* If we are reloading a pseudo-register that was set by the previous
  insn, see if we can get rid of that pseudo-register entirely
  by redirecting the previous insn into our reload register.  */
 
   else if (optimize  REG_P (old)
 
 Perhaps the above could handle subregs too, but I figure such a change
 probably isn't good for stage 4.  So the net result of this patch
 ought to just change the conditions under which we recheck secondary
 reloads.

Agreed on both points.

 Bootstrapped and regression tested powerpc64-linux, x86_64-linux
 bootstrap still chugging along.  OK to apply, assuming no regressions?
 
   PR target/57935
   * reload1.c (emit_input_reload_insns): When reload_override_in,
   set old to rl-in_reg when rl-in_reg is a subreg.

This is OK, assuming no regressions.

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  ulrich.weig...@de.ibm.com



Re: [PATCH] Properly check for _Cilk_spawn in return stmt (PR c/60197)

2014-02-26 Thread Marek Polacek
Ping.

On Wed, Feb 19, 2014 at 02:38:50PM +0100, Marek Polacek wrote:
 On Tue, Feb 18, 2014 at 10:06:14PM +, Iyer, Balaji V wrote:
  This is invalid.
 
 Thanks.  In that case, this patch should error out on such invalid uses as
 well, instead of ICEing.
 
 Regtested/bootstrapped on x86_64-linux.
 
 2014-02-19  Marek Polacek  pola...@redhat.com
 
   PR c/60197
 c-family/
   * cilk.c (contains_cilk_spawn_stmt): New function.
   (contains_cilk_spawn_stmt_walker): Likewise.
   (recognize_spawn): Give error on invalid use of _Cilk_spawn.
   * c-common.h (contains_cilk_spawn_stmt): Add declaration.
 c/
   * c-typeck.c (c_finish_return): Call contains_cilk_spawn_stmt instead
   of checking tree code.
 cp/
   * typeck.c (check_return_expr): Call contains_cilk_spawn_stmt instead
   of checking tree code.
 testsuite/
   * c-c++-common/cilk-plus/CK/pr60197.c: New test.
   * c-c++-common/cilk-plus/CK/pr60197-2.c: New test.
 
 diff --git gcc/c-family/c-common.h gcc/c-family/c-common.h
 index f074ab1..1099b10 100644
 --- gcc/c-family/c-common.h
 +++ gcc/c-family/c-common.h
 @@ -1389,4 +1389,5 @@ extern tree make_cilk_frame (tree);
  extern tree create_cilk_function_exit (tree, bool, bool);
  extern tree cilk_install_body_pedigree_operations (tree);
  extern void cilk_outline (tree, tree *, void *);
 +extern bool contains_cilk_spawn_stmt (tree);
  #endif /* ! GCC_C_COMMON_H */
 diff --git gcc/c-family/cilk.c gcc/c-family/cilk.c
 index f2179dfc..6a7bf4f 100644
 --- gcc/c-family/cilk.c
 +++ gcc/c-family/cilk.c
 @@ -235,6 +235,9 @@ recognize_spawn (tree exp, tree *exp0)
walk_tree (exp0, unwrap_cilk_spawn_stmt, NULL, NULL);
spawn_found = true;
  }
 +  /* _Cilk_spawn can't be wrapped in expression such as PLUS_EXPR.  */
 +  else if (contains_cilk_spawn_stmt (exp))
 +error (invalid use of %_Cilk_spawn%);
return spawn_found;
  }
  
 @@ -1292,3 +1295,25 @@ build_cilk_sync (void)
TREE_SIDE_EFFECTS (sync) = 1;
return sync;
  }
 +
 +/* Helper for contains_cilk_spawn_stmt, callback for walk_tree.  Return
 +   non-null tree if TP contains CILK_SPAWN_STMT.  */
 +
 +static tree
 +contains_cilk_spawn_stmt_walker (tree *tp, int *, void *)
 +{
 +  if (TREE_CODE (*tp) == CILK_SPAWN_STMT)
 +return *tp;
 +  else
 +return NULL_TREE;
 +}
 +
 +/* Returns true if EXPR or any of its subtrees contain CILK_SPAWN_STMT
 +   node.  */
 +
 +bool
 +contains_cilk_spawn_stmt (tree expr)
 +{
 +  return walk_tree (expr, contains_cilk_spawn_stmt_walker, NULL, NULL)
 +  != NULL_TREE;
 +}
 diff --git gcc/c/c-typeck.c gcc/c/c-typeck.c
 index 2b54290..7c4ba0e 100644
 --- gcc/c/c-typeck.c
 +++ gcc/c/c-typeck.c
 @@ -9140,7 +9140,7 @@ c_finish_return (location_t loc, tree retval, tree 
 origtype)
 return error_mark_node;
   }
  }
 -  if (flag_cilkplus  retval  TREE_CODE (retval) == CILK_SPAWN_STMT)
 +  if (flag_cilkplus  retval  contains_cilk_spawn_stmt (retval))
  {
error_at (loc, use of %_Cilk_spawn% in a return statement is not 
   allowed);
 diff --git gcc/cp/typeck.c gcc/cp/typeck.c
 index 5fc0e6b..566411f 100644
 --- gcc/cp/typeck.c
 +++ gcc/cp/typeck.c
 @@ -8328,7 +8328,7 @@ check_return_expr (tree retval, bool *no_warning)
  
*no_warning = false;
  
 -  if (flag_cilkplus  retval  TREE_CODE (retval) == CILK_SPAWN_STMT)
 +  if (flag_cilkplus  retval  contains_cilk_spawn_stmt (retval))
  {
error_at (EXPR_LOCATION (retval), use of %_Cilk_spawn% in a return 
   statement is not allowed);
 diff --git gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197-2.c 
 gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197-2.c
 index e69de29..1e5ca00 100644
 --- gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197-2.c
 +++ gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197-2.c
 @@ -0,0 +1,35 @@
 +/* PR c/60197 */
 +/* { dg-do compile } */
 +/* { dg-options -fcilkplus } */
 +
 +extern int foo (void);
 +
 +int
 +fn1 (void)
 +{
 +  int i;
 +  i = (_Cilk_spawn foo ()) + 1; /* { dg-error invalid use of } */
 +  return i;
 +}
 +
 +int
 +fn2 (void)
 +{
 +  int i = (_Cilk_spawn foo ()) + 1; /* { dg-error invalid use of } */
 +  return i;
 +}
 +
 +int
 +fn3 (int j, int k, int l)
 +{
 +  int i = (_Cilk_spawn foo ()) + 1) - l) * k) / j); /* { dg-error 
 invalid use of } */
 +  return i;
 +}
 +
 +int
 +fn4 (int j, int k, int l)
 +{
 +  int i;
 +  i = (_Cilk_spawn foo ()) + 1) - l) * k) / j); /* { dg-error invalid 
 use of } */
 +  return i;
 +}
 diff --git gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c 
 gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c
 index e69de29..2b47d1e 100644
 --- gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c
 +++ gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c
 @@ -0,0 +1,66 @@
 +/* PR c/60197 */
 +/* { dg-do compile } */
 +/* { dg-options -fcilkplus } */
 +
 +extern int foo (void);
 +extern int bar (int);
 +
 +int
 +fn1 (void)
 +{
 +  return (_Cilk_spawn foo ()) * 2; /* { dg-error in a return 

[PATCH, GOMP4] Fix OpenACC async clause

2014-02-26 Thread Ilmir Usmanov

Hi Thomas!

This patch is pretty obvious. Currently ASYNC clause cannot have 
integer-expression-list. Patch fixes this.


OK for gomp4 branch?

--
Ilmir.
From df76a29ebf869687209d7a606e243624cc136dbc Mon Sep 17 00:00:00 2001
From: Ilmir Usmanov i.usma...@samsung.com
Date: Wed, 26 Feb 2014 19:04:47 +0400
Subject: [PATCH 4/5] Fix ASYNC

---
 gcc/gimplify.c  | 4 ++--
 gcc/omp-low.c   | 4 ++--
 gcc/tree-core.h | 6 +++---
 gcc/tree.c  | 6 +++---
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index fd4305c..ce2f6a4 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -6186,10 +6186,10 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
 	case OMP_CLAUSE_DEVICE_RESIDENT:
 	case OMP_CLAUSE_USE_DEVICE:
 	case OMP_CLAUSE_GANG:
+	case OMP_CLAUSE_ASYNC:
 	case OMP_CLAUSE_WAIT:
 	case OMP_NO_CLAUSE_CACHE:
 	case OMP_CLAUSE_INDEPENDENT:
-	case OMP_CLAUSE_ASYNC:
 	case OMP_CLAUSE_WORKER:
 	case OMP_CLAUSE_VECTOR:
 	case OMP_CLAUSE_NUM_GANGS:
@@ -6545,11 +6545,11 @@ gimplify_adjust_omp_clauses (tree *list_p)
 	case OMP_CLAUSE_OACC_DEVICE:
 	case OMP_CLAUSE_DEVICE_RESIDENT:
 	case OMP_CLAUSE_USE_DEVICE:
+	case OMP_CLAUSE_ASYNC:
 	case OMP_CLAUSE_GANG:
 	case OMP_CLAUSE_WAIT:
 	case OMP_NO_CLAUSE_CACHE:
 	case OMP_CLAUSE_INDEPENDENT:
-	case OMP_CLAUSE_ASYNC:
 	case OMP_CLAUSE_WORKER:
 	case OMP_CLAUSE_VECTOR:
 	case OMP_CLAUSE_NUM_GANGS:
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 6dec687..eec862e 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1776,10 +1776,10 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 	case OMP_CLAUSE_DEVICE_RESIDENT:
 	case OMP_CLAUSE_USE_DEVICE:
 	case OMP_CLAUSE_GANG:
+	case OMP_CLAUSE_ASYNC:
 	case OMP_CLAUSE_WAIT:
 	case OMP_NO_CLAUSE_CACHE:
 	case OMP_CLAUSE_INDEPENDENT:
-	case OMP_CLAUSE_ASYNC:
 	case OMP_CLAUSE_WORKER:
 	case OMP_CLAUSE_VECTOR:
 	case OMP_CLAUSE_NUM_GANGS:
@@ -1916,10 +1916,10 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 	case OMP_CLAUSE_DEVICE_RESIDENT:
 	case OMP_CLAUSE_USE_DEVICE:
 	case OMP_CLAUSE_GANG:
+	case OMP_CLAUSE_ASYNC:
 	case OMP_CLAUSE_WAIT:
 	case OMP_NO_CLAUSE_CACHE:
 	case OMP_CLAUSE_INDEPENDENT:
-	case OMP_CLAUSE_ASYNC:
 	case OMP_CLAUSE_WORKER:
 	case OMP_CLAUSE_VECTOR:
 	case OMP_CLAUSE_NUM_GANGS:
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index fcdeb44..e9aeb65 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -286,6 +286,9 @@ enum omp_clause_code {
   size-expression: * | integer-expression.  */
   OMP_CLAUSE_GANG,
 
+  /* OpenACC clause: async [(integer-expression)].  */
+  OMP_CLAUSE_ASYNC,
+
   /* OpenACC clause/directive: wait [(integer-expression-list)].  */
   OMP_CLAUSE_WAIT,
 
@@ -372,9 +375,6 @@ enum omp_clause_code {
   /* OpenACC clause: independent.  */
   OMP_CLAUSE_INDEPENDENT,
 
-  /* OpenACC clause: async [(integer-expression)].  */
-  OMP_CLAUSE_ASYNC,
-
   /* OpenACC clause: worker [( [num:] integer-expression)].  */
   OMP_CLAUSE_WORKER,
 
diff --git a/gcc/tree.c b/gcc/tree.c
index 0655db0..7d4805e 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -263,6 +263,7 @@ unsigned const char omp_clause_num_ops[] =
   1, /* OMP_CLAUSE_OACC_DEVICE  */
   1, /* OMP_CLAUSE_DEVICE_RESIDENT  */
   1, /* OMP_CLAUSE_USE_DEVICE  */
+  1, /* OMP_CLAUSE_ASYNC  */
   1, /* OMP_CLAUSE_GANG  */
   1, /* OMP_CLAUSE_WAIT  */
   1, /* OMP_NO_CLAUSE_CACHE  */
@@ -292,7 +293,6 @@ unsigned const char omp_clause_num_ops[] =
   0, /* OMP_CLAUSE_TASKGROUP  */
   1, /* OMP_CLAUSE__SIMDUID_  */
   0, /* OMP_CLAUSE_INDEPENDENT  */
-  1, /* OMP_CLAUSE_ASYNC  */
   1, /* OMP_CLAUSE_WORKER  */
   1, /* OMP_CLAUSE_VECTOR  */
   1, /* OMP_CLAUSE_NUM_GANGS  */
@@ -322,6 +322,7 @@ const char * const omp_clause_code_name[] =
   device_resident,
   use_device,
   gang,
+  async,
   wait,
   _cache_,
   _looptemp_,
@@ -350,7 +351,6 @@ const char * const omp_clause_code_name[] =
   taskgroup,
   _simduid_,
   independent,
-  async,
   worker,
   vector,
   num_gangs,
@@ -11062,9 +11062,9 @@ walk_tree_1 (tree *tp, walk_tree_fn func, void *data,
 	case OMP_CLAUSE_DEVICE_RESIDENT:
 	case OMP_CLAUSE_USE_DEVICE:
 	case OMP_CLAUSE_GANG:
+	case OMP_CLAUSE_ASYNC:
 	case OMP_CLAUSE_WAIT:
 	case OMP_NO_CLAUSE_CACHE:
-	case OMP_CLAUSE_ASYNC:
 	case OMP_CLAUSE_WORKER:
 	case OMP_CLAUSE_VECTOR:
 	case OMP_CLAUSE_NUM_GANGS:
-- 
1.8.3.2



[PATCH] Change HONOR_REG_ALLOC_ORDER to a marco for C expression

2014-02-26 Thread Kito Cheng
This patch change the usage for HONOR_REG_ALLOC_ORDER, currently it's
can define or not define only. it's determine how cost caculate in
register allocation during gcc build time, and can't change it during
compile time.

However in some target, define HONOR_REG_ALLOC_ORDER is good for
optimize code size but get worse for performance such as nds32.

so I think make it's became a C expression style marco is the
solution, let back-end decide when we need HONOR_REG_ALLOC_ORDER
instead of decide it during build time.


2014-02-26  Kito Cheng  k...@0xlab.org
* defaults.h (HONOR_REG_ALLOC_ORDER): Change HONOR_REG_ALLOC_ORDER
to a C expression marco.
* ira-color.c (HONOR_REG_ALLOC_ORDER) : Ditto.
* config/arm/arm.h (HONOR_REG_ALLOC_ORDER): Ditto.
* config/nds32/nds32.h (HONOR_REG_ALLOC_ORDER): Ditto.
* doc/tm.texi (HONOR_REG_ALLOC_ORDER): Update document for
HONOR_REG_ALLOC_ORDER.
* doc/tm.texi.in (HONOR_REG_ALLOC_ORDER): Ditto.


diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 7ca47a7..1638332 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1152,7 +1152,7 @@ extern int arm_regs_in_sequence[];

 /* Tell IRA to use the order we define rather than messing it up with its
own cost calculations.  */
-#define HONOR_REG_ALLOC_ORDER
+#define HONOR_REG_ALLOC_ORDER 1

 /* Interrupt functions can only use registers that have already been
saved by the prologue, even if they would normally be
diff --git a/gcc/config/nds32/nds32.h b/gcc/config/nds32/nds32.h
index 38847e5..8f966ec 100644
--- a/gcc/config/nds32/nds32.h
+++ b/gcc/config/nds32/nds32.h
@@ -553,7 +553,7 @@ enum nds32_builtins

 /* Tell IRA to use the order we define rather than messing it up with its
own cost calculations.  */
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 7ca47a7..1638332 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1152,7 +1152,7 @@ extern int arm_regs_in_sequence[];

 /* Tell IRA to use the order we define rather than messing it up with its
own cost calculations.  */
-#define HONOR_REG_ALLOC_ORDER
+#define HONOR_REG_ALLOC_ORDER 1

 /* Interrupt functions can only use registers that have already been
saved by the prologue, even if they would normally be
diff --git a/gcc/config/nds32/nds32.h b/gcc/config/nds32/nds32.h
index 38847e5..8f966ec 100644
--- a/gcc/config/nds32/nds32.h
+++ b/gcc/config/nds32/nds32.h
@@ -553,7 +553,7 @@ enum nds32_builtins

 /* Tell IRA to use the order we define rather than messing it up with its
own cost calculations.  */
-#define HONOR_REG_ALLOC_ORDER
+#define HONOR_REG_ALLOC_ORDER 1

 /* The number of consecutive hard regs needed starting at
reg regno for holding a value of mode mode.  */
diff --git a/gcc/defaults.h b/gcc/defaults.h
index f94ae17..1c48759 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1085,6 +1085,10 @@ see the files COPYING3 and COPYING.RUNTIME
respectively.  If not, see
 #define LOCAL_REGNO(REGNO)  0
 #endif

+#ifndef HONOR_REG_ALLOC_ORDER
+#define HONOR_REG_ALLOC_ORDER 0
+#endif
+
 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
the stack pointer does not matter.  The value is tested only in
functions that have frame pointers.  */
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
...skipping...
   int saved_nregs;
   enum reg_class rclass;
   int add_cost;
-#endif
 #ifdef STACK_REGS
   bool no_stack_reg_p;
 #endif
@@ -1823,19 +1819,21 @@ assign_hard_reg (ira_allocno_t a, bool retry_p)
continue;
   cost = costs[i];
   full_cost = full_costs[i];
-#ifndef HONOR_REG_ALLOC_ORDER
-  if ((saved_nregs = calculate_saved_nregs (hard_regno, mode)) != 0)
-   /* We need to save/restore the hard register in
-  epilogue/prologue.  Therefore we increase the cost.  */
-   {
- rclass = REGNO_REG_CLASS (hard_regno);
- add_cost = ((ira_memory_move_cost[mode][rclass][0]
-  + ira_memory_move_cost[mode][rclass][1])
- * saved_nregs / hard_regno_nregs[hard_regno][mode] - 1);
- cost += add_cost;
   int saved_nregs;
   enum reg_class rclass;
   int add_cost;
-#endif
 #ifdef STACK_REGS
   bool no_stack_reg_p;
 #endif
@@ -1823,19 +1819,21 @@ assign_hard_reg (ira_allocno_t a, bool retry_p)
continue;
   cost = costs[i];
   full_cost = full_costs[i];
-#ifndef HONOR_REG_ALLOC_ORDER
-  if ((saved_nregs = calculate_saved_nregs (hard_regno, mode)) != 0)
-   /* We need to save/restore the hard register in
-  epilogue/prologue.  Therefore we increase the cost.  */
-   {
- rclass = REGNO_REG_CLASS (hard_regno);
- add_cost = ((ira_memory_move_cost[mode][rclass][0]
-  + ira_memory_move_cost[mode][rclass][1])
- * saved_nregs / hard_regno_nregs[hard_regno][mode] - 1);
- cost += add_cost;
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 7ca47a7..1638332 100644
--- 

Re: [PATCH][AArch64] vrnd*_f64 patch for stage-1

2014-02-26 Thread Marcus Shawcroft
On 21 February 2014 12:44, Alex Velenko alex.vele...@arm.com wrote:

 This patch adds vrnd*_f64 aarch64 intrinsics. A testcase for those
 intrinsics is added. Run a complete LE and BE regression run with no
 regressions.

 Is patch OK for stage-1?

 gcc/

 2014-02-21  Alex Velenko  alex.vele...@arm.com


 * config/aarch64/aarch64-builtins.c (BUILTIN_VDQF_DF): Macro
 added.
 * config/aarch64/aarch64-simd-builtins.def (frintn): Use added
 macro.
 * config/aarch64/aarch64-simd.md (frint_pattern): Comment
 corrected.
 * config/aarch64/aarch64.md (frint_pattern): Likewise.
 * config/aarch64/arm_neon.h (vrnd_f64): Added.
 (vrnda_f64): Likewise.
 (vrndi_f64): Likewise.
 (vrndm_f64): Likewise.
 (vrndn_f64): Likewise.
 (vrndp_f64): Likewise.
 (vrndx_f64): Likewise.

 gcc/testsuite/

 2014-02-21  Alex Velenko  alex.vele...@arm.com

 gcc.target/aarch64/vrnd_f64_1.c : New testcase.



Ok for stage-1

/Marcus


Re: [PATCH] Fixing SEH exceptions for languages != C++

2014-02-26 Thread Kai Tietz
Hello Jonathan,

2014-02-20 20:19 GMT+01:00 Jonathan Schleifer j...@webkeks.org:
 There is also definitely a use-after-free if you call _Unwind_DeleteException 
 in your personality before returning _URC_INSTALL_CONTEXT (which you should, 
 if you don't want to leak and your landing pad doesn't call it). I'm not sure 
 though how to fix it. It seems the problem that register 0 is ignored is 
 present throughout the whole file and it seems that a proper fix gets a 
 little bit more complicated.

 --
 Jonathan

Sorry for replying a bit late to your thread.  For current stage of
gcc further changes in this area need to be postponed.
The use-after-free issue you mention is for sure something we should
address in upcoming stage 1. So you are welcome to work on this area.
You might want to make already your papers with fsf, as they are
required for further contributions to gcc.

Regards,
Kai


Re: C++ PATCH for DR 1571 (reference binding)

2014-02-26 Thread Jason Merrill

On 02/25/2014 04:27 PM, Jason Merrill wrote:

I'm a
little uncertain about applying this so late in the 4.9 cycle, but I
think it's a significant improvement to C++11 support.


But it broke firefox, so I've reverted it.  I'll try again in stage 1.

Jason




C++ PATCH for c++/54440 (fixed parameter packs)

2014-02-26 Thread Jason Merrill
A parameter pack of a member template that depends on a template 
parameter pack from an enclosing class template is what I'm going to 
call a fixed parameter pack: the length of the pack expansion is 
determined by the template arguments of the enclosing class template, 
not by any template or function arguments of the member template.  So we 
need to handle a fixed parameter pack differently, and not try to pack 
too many arguments into the argument pack we build up for it.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 343ce7de92991a14169a881ad952bf86906d3e84
Author: Jason Merrill ja...@redhat.com
Date:   Fri Feb 22 09:43:57 2013 -0500

	PR c++/54440
	* pt.c (get_template_parm_index): New.
	(fixed_parameter_pack_p_1, fixed_parameter_pack_p): New.
	(process_template_parm): Allow bare packs in template template
	parm template parms.
	(coerce_template_parameter_pack): Handle fixed template template
	parm packs and fixed packs not at the end of the parm list.
	(coerce_template_parms): Handle template parm packs not at the end
	of the parm list.
	(gen_elem_of_pack_expansion_instantiation): Handle a decl expansion.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index d723311..1f5a2b7 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -3697,7 +3697,10 @@ process_template_parm (tree list, location_t parm_loc, tree parm,
 	 return chainon (list, err_parm_list);
   }
 
-if (uses_parameter_packs (TREE_TYPE (parm))  !is_parameter_pack)
+if (uses_parameter_packs (TREE_TYPE (parm))  !is_parameter_pack
+	/* If we're in a nested template parameter list, the template
+	   template parameter could be a parameter pack.  */
+	 processing_template_parmlist == 1)
 	  {
 	/* This template parameter is not a parameter pack, but it
 	   should be. Complain about bare parameter packs.  */
@@ -4326,6 +4329,77 @@ process_partial_specialization (tree decl)
   return decl;
 }
 
+/* PARM is a template parameter of some form; return the corresponding
+   TEMPLATE_PARM_INDEX.  */
+
+static tree
+get_template_parm_index (tree parm)
+{
+  if (TREE_CODE (parm) == PARM_DECL
+  || TREE_CODE (parm) == CONST_DECL)
+parm = DECL_INITIAL (parm);
+  else if (TREE_CODE (parm) == TYPE_DECL
+	   || TREE_CODE (parm) == TEMPLATE_DECL)
+parm = TREE_TYPE (parm);
+  if (TREE_CODE (parm) == TEMPLATE_TYPE_PARM
+  || TREE_CODE (parm) == TEMPLATE_TEMPLATE_PARM)
+parm = TEMPLATE_TYPE_PARM_INDEX (parm);
+  gcc_assert (TREE_CODE (parm) == TEMPLATE_PARM_INDEX);
+  return parm;
+}
+
+/* Subroutine of fixed_parameter_pack_p below.  Look for any template
+   parameter packs used by the template parameter PARM.  */
+
+static void
+fixed_parameter_pack_p_1 (tree parm, struct find_parameter_pack_data *ppd)
+{
+  /* A type parm can't refer to another parm.  */
+  if (TREE_CODE (parm) == TYPE_DECL)
+return;
+  else if (TREE_CODE (parm) == PARM_DECL)
+{
+  cp_walk_tree (TREE_TYPE (parm), find_parameter_packs_r,
+		ppd, ppd-visited);
+  return;
+}
+
+  gcc_assert (TREE_CODE (parm) == TEMPLATE_DECL);
+
+  tree vec = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (parm));
+  for (int i = 0; i  TREE_VEC_LENGTH (vec); ++i)
+fixed_parameter_pack_p_1 (TREE_VALUE (TREE_VEC_ELT (vec, i)), ppd);
+}
+
+/* PARM is a template parameter pack.  Return any parameter packs used in
+   its type or the type of any of its template parameters.  If there are
+   any such packs, it will be instantiated into a fixed template parameter
+   list by partial instantiation rather than be fully deduced.  */
+
+tree
+fixed_parameter_pack_p (tree parm)
+{
+  /* This can only be true in a member template.  */
+  if (TEMPLATE_PARM_ORIG_LEVEL (get_template_parm_index (parm))  2)
+return NULL_TREE;
+  /* This can only be true for a parameter pack.  */
+  if (!template_parameter_pack_p (parm))
+return NULL_TREE;
+  /* A type parm can't refer to another parm.  */
+  if (TREE_CODE (parm) == TYPE_DECL)
+return NULL_TREE;
+
+  tree parameter_packs = NULL_TREE;
+  struct find_parameter_pack_data ppd;
+  ppd.parameter_packs = parameter_packs;
+  ppd.visited = pointer_set_create ();
+
+  fixed_parameter_pack_p_1 (parm, ppd);
+
+  pointer_set_destroy (ppd.visited);
+  return parameter_packs;
+}
+
 /* Check that a template declaration's use of default arguments and
parameter packs is not invalid.  Here, PARMS are the template
parameters.  IS_PRIMARY is true if DECL is the thing declared by
@@ -4431,7 +4505,10 @@ check_default_tmpl_args (tree decl, tree parms, bool is_primary,
 		parm_level == parms
 		TREE_CODE (decl) == TYPE_DECL
 		i  ntparms - 1
-		template_parameter_pack_p (TREE_VALUE (parm)))
+		template_parameter_pack_p (TREE_VALUE (parm))
+		   /* A fixed parameter pack will be partially
+			  instantiated into a fixed length list.  */
+		!fixed_parameter_pack_p (TREE_VALUE (parm)))
 		{
 		  /* A primary 

Re: std::regex_replace behaviour (LWG DR 2213)

2014-02-26 Thread Tim Shen
On Fri, Feb 14, 2014 at 10:38 AM, Tim Shen timshe...@gmail.com wrote:
 On Fri, Feb 14, 2014 at 5:59 AM, Paolo Carlini paolo.carl...@oracle.com 
 wrote:
 .. I think it would be cleaner to have new, separate testcases, named after
 2213. This is what we always did in the past when we implemented resolutions
 of DRs.

 No problem.

Booted  tested with -m32 and -m64 respectively, and committed.


-- 
Regards,
Tim Shen


[PATCH] Fix up -Wmaybe-uninitialized (PR middle-end/59223)

2014-02-26 Thread Marek Polacek
This fixes an oversight where we didn't run execute_late_warn_uninitialized
when only -Wmaybe-uninitialize was specified -- gate_warn_uninitialized
should take warn_maybe_uninitialized into account.

Regtested/bootstrapped on x86_64-linux, ok for trunk?

2014-02-26  Marek Polacek  pola...@redhat.com

PR middle-end/59223
* tree-ssa-uninit.c (gate_warn_uninitialized): Run the pass even for
-Wmaybe-uninitialized.
testsuite/
* c-c++-common/pr59223.c: New test.

diff --git gcc/testsuite/c-c++-common/pr59223.c 
gcc/testsuite/c-c++-common/pr59223.c
index e69de29..471c062 100644
--- gcc/testsuite/c-c++-common/pr59223.c
+++ gcc/testsuite/c-c++-common/pr59223.c
@@ -0,0 +1,13 @@
+/* PR c/59223 */
+/* { dg-do compile } */
+/* { dg-options -O2 -Wmaybe-uninitialized } */
+
+int foo (int x)
+{
+  int y;
+  if (x == 0)
+y = 1;
+  else if (x == 1)
+y = 2;
+  return y; /* { dg-warning may be used uninitialized in this function } */
+}
diff --git gcc/tree-ssa-uninit.c gcc/tree-ssa-uninit.c
index d9b33b1..eee83f7 100644
--- gcc/tree-ssa-uninit.c
+++ gcc/tree-ssa-uninit.c
@@ -2355,7 +2355,7 @@ execute_late_warn_uninitialized (void)
 static bool
 gate_warn_uninitialized (void)
 {
-  return warn_uninitialized != 0;
+  return warn_uninitialized || warn_maybe_uninitialized;
 }
 
 namespace {

Marek


Re: [PATCH] Fix up -Wmaybe-uninitialized (PR middle-end/59223)

2014-02-26 Thread Richard Biener
On February 26, 2014 8:58:11 PM GMT+01:00, Marek Polacek pola...@redhat.com 
wrote:
This fixes an oversight where we didn't run
execute_late_warn_uninitialized
when only -Wmaybe-uninitialize was specified -- gate_warn_uninitialized
should take warn_maybe_uninitialized into account.

Regtested/bootstrapped on x86_64-linux, ok for trunk?

Ok.

Thanks,
Richard.

2014-02-26  Marek Polacek  pola...@redhat.com

   PR middle-end/59223
   * tree-ssa-uninit.c (gate_warn_uninitialized): Run the pass even for
   -Wmaybe-uninitialized.
testsuite/
   * c-c++-common/pr59223.c: New test.

diff --git gcc/testsuite/c-c++-common/pr59223.c
gcc/testsuite/c-c++-common/pr59223.c
index e69de29..471c062 100644
--- gcc/testsuite/c-c++-common/pr59223.c
+++ gcc/testsuite/c-c++-common/pr59223.c
@@ -0,0 +1,13 @@
+/* PR c/59223 */
+/* { dg-do compile } */
+/* { dg-options -O2 -Wmaybe-uninitialized } */
+
+int foo (int x)
+{
+  int y;
+  if (x == 0)
+y = 1;
+  else if (x == 1)
+y = 2;
+  return y; /* { dg-warning may be used uninitialized in this
function } */
+}
diff --git gcc/tree-ssa-uninit.c gcc/tree-ssa-uninit.c
index d9b33b1..eee83f7 100644
--- gcc/tree-ssa-uninit.c
+++ gcc/tree-ssa-uninit.c
@@ -2355,7 +2355,7 @@ execute_late_warn_uninitialized (void)
 static bool
 gate_warn_uninitialized (void)
 {
-  return warn_uninitialized != 0;
+  return warn_uninitialized || warn_maybe_uninitialized;
 }
 
 namespace {

   Marek




[PING]RE: [PING] [PATCH] _Cilk_for for C and C++

2014-02-26 Thread Iyer, Balaji V
Hi Jakub,
Did you get a chance to look at this?

Thanks,

Balaji V. Iyer.

 -Original Message-
 From: Iyer, Balaji V
 Sent: Monday, February 24, 2014 6:17 PM
 To: 'Jakub Jelinek'
 Cc: 'Jason Merrill'; 'Jeff Law'; 'Aldy Hernandez'; 'gcc-patches@gcc.gnu.org';
 'r...@redhat.com'
 Subject: RE: [PING] [PATCH] _Cilk_for for C and C++
 
 Hi Jakub,
   Please see my responses below.
 
  -Original Message-
  From: Iyer, Balaji V
  Sent: Thursday, February 20, 2014 11:38 PM
  To: Jakub Jelinek
  Cc: 'Jason Merrill'; 'Jeff Law'; 'Aldy Hernandez';
  'gcc-patches@gcc.gnu.org'; 'r...@redhat.com'
  Subject: RE: [PING] [PATCH] _Cilk_for for C and C++
 
  Hi Jakub,
  I have attached the fixed patch and have answered your questions
  below.
 
   -Original Message-
   From: Jakub Jelinek [mailto:ja...@redhat.com]
   Sent: Wednesday, February 19, 2014 6:24 AM
   To: Iyer, Balaji V
   Cc: 'Jason Merrill'; 'Jeff Law'; 'Aldy Hernandez';
   'gcc-patches@gcc.gnu.org'; 'r...@redhat.com'
   Subject: Re: [PING] [PATCH] _Cilk_for for C and C++
  
   On Wed, Feb 19, 2014 at 04:43:06AM +, Iyer, Balaji V wrote:
Attached, please find a patch with the test case attached (for1.cc).
The patch is the same but the cp-changelog has been modified to
reflect the new test-case.  Is this OK to install?
  
   1) have you tested the patch at all?  I see
   FAIL: g++.dg/gomp/for-1.C -std=c++98  (test for errors, line 27)
   FAIL: g++.dg/gomp/for-1.C -std=c++98 (test for excess errors)
   FAIL: g++.dg/gomp/for-1.C -std=c++11  (test for errors, line 27)
   FAIL: g++.dg/gomp/for-1.C -std=c++11 (test for excess errors)
   FAIL: g++.dg/gomp/for-19.C -std=gnu++98 (internal compiler error)
   FAIL: g++.dg/gomp/for-19.C -std=gnu++98  (test for warnings, line
   30)
   FAIL: g++.dg/gomp/for-19.C -std=gnu++98  (test for warnings, line
   37)
   FAIL: g++.dg/gomp/for-19.C -std=gnu++98  (test for warnings, line
   40)
   FAIL: g++.dg/gomp/for-19.C -std=gnu++98 (test for excess errors)
   FAIL: g++.dg/gomp/for-19.C -std=gnu++11 (internal compiler error)
   FAIL: g++.dg/gomp/for-19.C -std=gnu++11  (test for warnings, line
   30)
   FAIL: g++.dg/gomp/for-19.C -std=gnu++11  (test for warnings, line
   37)
   FAIL: g++.dg/gomp/for-19.C -std=gnu++11  (test for warnings, line
   40)
   FAIL: g++.dg/gomp/for-19.C -std=gnu++11 (test for excess errors)
   regressions caused by the patch, that is of course unacceptable.
  
 
  Fixed. I apologize for them. I have confirmed that it is OK now.
 
 
   2) try this updated cf3.cc, e.g. with -O2 -fcilkplus if you can't
   find out why calling something multiple times is a bad idea,
   actually the latest patch is even worse than the older one, you now
   create 3 calls to the end method and 3 calls to operator-.  There
   should be just one call to that, before the #pragma omp parallel
   obviously, anything that
  doesn't do that is just bad.
   I don't see a point in having if clause on the _Cilk_for, just keep
   it on the #pragma omp parallel only, at ompexp time you can easily
   find it there, there is no point to check it again in the parallel
   body of the
  function.
  
 
  I have removed the if-clause from the _Cilk_for and now it is just in
  #pragma omp parallel.
 
  I have removed the 3rd operator-, but I am not able to remove the 2nd.
  I am looking into it, but I am not able to do it. The thing is, first
  operator- was for the if-clause, which I need to calculate the
  loop-count for the
  __cilkrts_cilk_for_64 function. The second one is not necessary
  because the end-value does not matter for _Cilk_for since they will be
  replaced with the low and high values.  I tried several things such as
  stopping gimplifcation of the cond value, or replacing it with a
  constant, etc and those are causing other problems elsewhere.
 
   The thing is, I am not able to find a way to automate this. I can't
  assume the cond's  end-value is same as count, because this is only
  true if we have an iterator and the handle_omp_for_iterator function
  modifies the cond value correctly. I need to use the count value
  (retval.0) as retval.1 but count-value is computed at a later time
  than handle_omp_for_iterator (since it does not have any knowledge
  about the #pragma omp parallel). It is giving the correct answers for
  the benchmarks and is removing the 2nd operator- when optimization is
 turned on for the inlinable operator-.
 
  Can you provide me some advice about how to do it?
 
 I have fixed the issue. Now the 2nd operator- does not occur. Attached,
 please fixed a fixed patch. Is this OK for trunk?
 
 Thanks,
 
 Balaji V. Iyer.


Re: [PATCH,GRAPHITE] Fix for P1 bug 58028

2014-02-26 Thread Tobias Grosser

On 02/26/2014 10:09 PM, Mircea Namolaru wrote:

This patch fixes the libgomp problems:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58028

2014-02-26 Tobias Grosser tob...@grosser.es
Mircea Namolaru mnamo...@inria.fr

Fix for bug 58028
* graphite-clast-to-gimple.c (set_cloog_options):
Don't remove scalar dimensions

Index: gcc/graphite-clast-to-gimple.c
===
--- gcc/graphite-clast-to-gimple.c (revision 207298)
+++ gcc/graphite-clast-to-gimple.c (working copy)
@@ -1522,6 +1522,13 @@
variables. */
options-save_domains = 1;

+ /* Do not remove scalar dimensions. Cloog be default removes scalar
+ dimensions very early from the input schedule. However, they are
+ necessary to correctly derive from the saved domains
+ (options-save_domains) the relationship between the generated loops
+ and the schedule dimensions they are generated from. */
+ options-noscalars = 1;
+
/* Disable optimizations and make cloog generate source code closer to the
input. This is useful for debugging, but later we want the optimized
code.

Tested on x86-64 Linux, no regressions for c/c++/fortran.

Got a notification failure from gcc-patches for the initial submission of this
patch. However, Tobias (on cc) received it and already sent his comments,
(see http://gcc.gnu.org/ml/gcc-patches/2014-02/msg01540.html), that are
addressed in this re-submission.


Yes, very nice. Thanks Mircea for reacting so quickly. This patch look 
good to me.


@Release-managers: Is this patch OK for trunk?

Cheers,
Tobias



Re: [C++ patch] for C++/52369

2014-02-26 Thread Fabien Chêne
Ping (yeah boring to review!)

2014-02-23 20:36 GMT+01:00 Fabien Chêne fabien.ch...@gmail.com:
 Ahem, patch resubmitted with the testsuite correctly adjusted this
 time. Tested x86_64 linux, still OK to commit ?

 2014-02-23  Fabien Chene  fab...@gcc.gnu.org
 PR c++/52369
 * cp/method.c (walk_field_subobs): improve the diagnostic
 locations for both REFERENCE_TYPEs and non-static const members.

 2014-02-23  Fabien Chene  fab...@gcc.gnu.org

 PR c++/52369
 * g++.dg/init/const10.C: New.
 * g++.dg/init/const11.C: New.
 * g++.dg/init/pr25811.C: Adjust.
 * g++.dg/init/pr29043.C: Adjust.
 * g++.dg/init/pr43719.C: Likewise.
 * g++.dg/init/pr44086.C: Likewise.
 * g++.dg/init/ctor4.C: Likewise.
 * g++.dg/init/ctor8.C: Likewise.
 * g++.dg/init/uninitialized1.C: Likewise.

-- 
Fabien


C++ PATCH for c++/59231 (missed warning in template instantiation)

2014-02-26 Thread Jason Merrill
As discussed in the PR, I think my earlier suggestion to use 
c_inhibit_evaluation_warnings to suppress undesirable warnings from 
template instantiations was wrong.  That flag should only be used for 
suppressing warnings that are irrelevant because the expression is never 
evaluated, which may or may not be the case during template instantiation.


Instead, this patch suppresses specific warning flags during template 
substitution: warn_div_by_zero, warn_type_limits, and warn_useless_cast.


This is may well produce more warnings from template-heavy code.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit 04b9e92db4acaa442552e87b18682c7b01275017
Author: Jason Merrill ja...@redhat.com
Date:   Wed Feb 26 13:49:23 2014 -0500

	PR c++/59231
	PR c++/11586
	PR c++/14710
	PR c++/57132
gcc/
	* c-common.c (shorten_compare): Don't check
	c_inhibit_evaluation_warnings.
gcc/cp/
	* pt.c (struct warning_sentinel): New.
	(tsubst_copy_and_build): Use it instead of
	c_inhibit_evaluation_warnings.

diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index e23a9df..abd96fb 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -4218,8 +4218,7 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr,
 	  type = c_common_unsigned_type (type);
 	}
 
-  if (TREE_CODE (primop0) != INTEGER_CST
-	   c_inhibit_evaluation_warnings == 0)
+  if (TREE_CODE (primop0) != INTEGER_CST)
 	{
 	  if (val == truthvalue_false_node)
 	warning_at (loc, OPT_Wtype_limits,
@@ -4299,7 +4298,6 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr,
 	 warning.  */
 	  bool warn = 
 	warn_type_limits  !in_system_header_at (loc)
-	 c_inhibit_evaluation_warnings == 0
 	 !(TREE_CODE (primop0) == INTEGER_CST
 		  !TREE_OVERFLOW (convert (c_common_signed_type (type),
 	 primop0)))
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 1f5a2b7..8126905 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1,4 +1,4 @@
-/* Handle parameterized types (templates) for GNU C++.
+/* Handle parameterized types (templates) for GNU -*- C++ -*-.
Copyright (C) 1992-2014 Free Software Foundation, Inc.
Written by Ken Raeburn (raeb...@cygnus.com) while at Watchmaker Computing.
Rewritten by Jason Merrill (ja...@cygnus.com).
@@ -14063,6 +14063,16 @@ tsubst_non_call_postfix_expression (tree t, tree args,
   return t;
 }
 
+/* Sentinel to disable certain warnings during template substitution.  */
+
+struct warning_sentinel {
+  int flag;
+  int val;
+  warning_sentinel(int flag, bool suppress=true)
+: flag(flag), val(flag) { if (suppress) flag = 0; }
+  ~warning_sentinel() { flag = val; }
+};
+
 /* Like tsubst but deals with expressions and performs semantic
analysis.  FUNCTION_P is true if T is the F in F (ARGS).  */
 
@@ -14229,7 +14239,7 @@ tsubst_copy_and_build (tree t,
 
 	op = RECUR (TREE_OPERAND (t, 0));
 
-	++c_inhibit_evaluation_warnings;
+	warning_sentinel s(warn_useless_cast);
 	switch (TREE_CODE (t))
 	  {
 	  case CAST_EXPR:
@@ -14250,7 +14260,6 @@ tsubst_copy_and_build (tree t,
 	  default:
 	gcc_unreachable ();
 	  }
-	--c_inhibit_evaluation_warnings;
 
 	RETURN (r);
   }
@@ -14325,11 +14334,9 @@ tsubst_copy_and_build (tree t,
 case MEMBER_REF:
 case DOTSTAR_EXPR:
   {
-	tree r;
-
-	++c_inhibit_evaluation_warnings;
-
-	r = build_x_binary_op
+	warning_sentinel s1(warn_type_limits);
+	warning_sentinel s2(warn_div_by_zero);
+	tree r = build_x_binary_op
 	  (input_location, TREE_CODE (t),
 	   RECUR (TREE_OPERAND (t, 0)),
 	   (TREE_NO_WARNING (TREE_OPERAND (t, 0))
@@ -14344,8 +14351,6 @@ tsubst_copy_and_build (tree t,
 	if (EXPR_P (r)  TREE_NO_WARNING (t))
 	  TREE_NO_WARNING (r) = TREE_NO_WARNING (t);
 
-	--c_inhibit_evaluation_warnings;
-
 	RETURN (r);
   }
 
@@ -14460,11 +14465,8 @@ tsubst_copy_and_build (tree t,
 
 case MODOP_EXPR:
   {
-	tree r;
-
-	++c_inhibit_evaluation_warnings;
-
-	r = build_x_modify_expr
+	warning_sentinel s(warn_div_by_zero);
+	tree r = build_x_modify_expr
 	  (EXPR_LOCATION (t),
 	   RECUR (TREE_OPERAND (t, 0)),
 	   TREE_CODE (TREE_OPERAND (t, 1)),
@@ -14479,8 +14481,6 @@ tsubst_copy_and_build (tree t,
 	if (TREE_NO_WARNING (t))
 	  TREE_NO_WARNING (r) = TREE_NO_WARNING (t);
 
-	--c_inhibit_evaluation_warnings;
-
 	RETURN (r);
   }
 
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 5fc0e6b..1e14b63 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -6282,8 +6282,7 @@ void
 maybe_warn_about_useless_cast (tree type, tree expr, tsubst_flags_t complain)
 {
   if (warn_useless_cast
-   complain  tf_warning
-   c_inhibit_evaluation_warnings == 0)
+   complain  tf_warning)
 {
   if (REFERENCE_REF_P (expr))
 	expr = TREE_OPERAND (expr, 0);
diff --git a/gcc/testsuite/g++.dg/cilk-plus/AN/array_test2_tplt.cc b/gcc/testsuite/g++.dg/cilk-plus/AN/array_test2_tplt.cc
index 87c37e1..041c052 100644
--- a/gcc/testsuite/g++.dg/cilk-plus/AN/array_test2_tplt.cc

[Patch, fortran] PR59198 - [4.7/4.8/4.9 Regression] ICE on cyclically dependent polymorphic types

2014-02-26 Thread Paul Richard Thomas
Dear All,

The attached patch allows the original testcase to compile but
attempting to use it runs into segfaults at runtime.  The initializer
for 'decay_t' has a bad FIELD_DECL for 'decay_gen_t' since it lacks
the DECL_SIZE(_UNIT) fields but the TYPE_SIZE(_UNIT) fields are OK.
The patch runs through the constructor and restores the missing
fields, thus preventing the ICE in varasm.c.

Taking the reduced testcase of comment #4 and adding a main program:

module decays

  implicit none

  interface
real elemental function iface (arg)
  real, intent(in) :: arg
end function
  end interface

  type :: decay_term_t
 type(decay_t), pointer :: unstable_product
  end type

  type :: decay_gen_t
 procedure(iface), nopass, pointer :: obs1_int
 type(decay_term_t), allocatable :: term
  end type

  type :: rng_t
integer :: i
  end type

  type, extends (decay_gen_t) :: decay_t
 class(rng_t), allocatable :: rng
  end type

  class(decay_t), allocatable :: object

end

  use decays
  type(decay_t), pointer :: template
  allocate (template)
  allocate (template%rng)
  template%obs1_int = cos
  print *, template%obs1_int (3.14159/2.)
  allocate (object, source = template)
!  print *, object%obs1_int (3.14159/2.) ! This should be OK but it
segfaults at runtime.
  object%obs1_int = sin
  print *, object%obs1_int (3.14159/2.)
end

This runs correctly.  However, the commented out line causes a
segfault in runtime.  I haven't attempted yet to understand why this
should be the case but it is obvious that the _copy procedure for
decay_t has something wrong with it.

The patch, therefore is neither ready in principle to be committed and
uncouvers other nasties.  I have two questions that I hope that
somebody can answer:
(i) How or why is it possible for build_constructor to produce
incomplete FIELD_DECLS?; and
(ii) What is wrong with the _copy procedure?

I cannot return to the fray for slightly more than a week.

Best regards

Paul
Index: gcc/fortran/trans-expr.c
===
*** gcc/fortran/trans-expr.c(revision 208048)
--- gcc/fortran/trans-expr.c(working copy)
*** gfc_conv_structure (gfc_se * se, gfc_exp
*** 6175,6180 
--- 6175,6201 
se-expr = build_constructor (type, v);
if (init)
  TREE_CONSTANT (se-expr) = 1;
+ 
+   /* Verify that the DECL_SIZE fields have been set so that the
+  constructor is ready for varasm.c(output_constructor_regular_field).
+  TODO: Find out why this is very occasionally necessary.
+  See PR59198.  */
+   type = TREE_TYPE (se-expr);
+   if (TREE_CODE (type) == RECORD_TYPE)
+ {
+   tmp = TYPE_FIELDS (type);
+   while (tmp)
+   {
+ if (TREE_CODE (tmp) == FIELD_DECL
+  DECL_SIZE_UNIT (tmp) == NULL_TREE)
+   {
+ DECL_SIZE (tmp) = TYPE_SIZE (TREE_TYPE (tmp));
+ DECL_SIZE_UNIT (tmp) = TYPE_SIZE_UNIT (TREE_TYPE (tmp));
+   }
+ tmp = TREE_CHAIN (tmp);
+   }
+ }
+ 
  }
  
  


Re: C++ PATCH for lto/53808 (devirtualization of defaulted virtual dtor)

2014-02-26 Thread Jason Merrill

On 02/25/2014 01:53 PM, Jason Merrill wrote:

The primary bug under discussion in 53808 has been fixed separately, but
it also pointed out that once devirtualization resolves the delete to
use the bar destructor, we ought to be able to inline that destructor.
So if we're devirtualizing, always add a virtual defaulted dtor to the
list of functions to be synthesized.


But this caused bug 60347: turns out that we shouldn't do this unless 
the vtable (and thus the contents of the vtable) are used.


Tested x86_64-pc-linux-gnu, applying to trunk.


commit 0e5db39431e8f66255a2566f22054878b18baf08
Author: Jason Merrill ja...@redhat.com
Date:   Wed Feb 26 15:40:42 2014 -0500

	PR c++/60347
	PR lto/53808
	* class.c (clone_function_decl): Don't note_vague_linkage_fn.
	* init.c (build_vtbl_address): Do it here.

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index f61dc9d..b46391b 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4584,10 +4584,6 @@ clone_function_decl (tree fn, int update_method_vec_p)
 	 destructor.  */
   if (DECL_VIRTUAL_P (fn))
 	{
-	  if (DECL_DEFAULTED_FN (fn)  flag_devirtualize)
-	/* Make sure the destructor gets synthesized so that it can be
-	   inlined after devirtualization.  */
-	note_vague_linkage_fn (fn);
 	  clone = build_clone (fn, deleting_dtor_identifier);
 	  if (update_method_vec_p)
 	add_method (DECL_CONTEXT (clone), clone, NULL_TREE);
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 194a797..3ae2b5c 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1123,7 +1123,13 @@ build_vtbl_address (tree binfo)
   /* Figure out what vtable BINFO's vtable is based on, and mark it as
  used.  */
   vtbl = get_vtbl_decl_for_binfo (binfo_for);
-  TREE_USED (vtbl) = 1;
+  if (tree dtor = CLASSTYPE_DESTRUCTORS (DECL_CONTEXT (vtbl)))
+if (!TREE_USED (vtbl)  DECL_VIRTUAL_P (dtor)  DECL_DEFAULTED_FN (dtor))
+  /* Make sure the destructor gets synthesized so that it can be
+	 inlined after devirtualization even if the vtable is never
+	 emitted.  */
+  note_vague_linkage_fn (dtor);
+  TREE_USED (vtbl) = true;
 
   /* Now compute the address to use when initializing the vptr.  */
   vtbl = unshare_expr (BINFO_VTABLE (binfo_for));
diff --git a/gcc/testsuite/g++.dg/template/dtor9.C b/gcc/testsuite/g++.dg/template/dtor9.C
new file mode 100644
index 000..fd71389
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/dtor9.C
@@ -0,0 +1,12 @@
+// PR c++/60347
+
+struct A;
+
+template class T
+struct B
+{
+  T* p;
+  virtual ~B() { p-~T(); }
+};
+
+struct C: BA { };


Re: PR60147: fix ICE with DECL_NAMELIST and tree-pretty-printer.c

2014-02-26 Thread Tobias Burnus

Dear all,

as suggested by Richard, it now only prints the namelist name and no 
longer the variables of the namelist.


Bootstrapped on x86-64-gnu-linux and currently regtesting.
OK for the trunk when it succeeds?

Tobias

On February 22, 2014 10:00, Tobias Burnus wrote:
Since GCC 4.9, gfortran generates a DECL_NAMELIST (for DWARF's 
DW_TAG_namelist) - they are stored in the BIND_EXPR. Namelists are a 
bit boring: They only group variable names and the namelist name is 
only used in I/O statements (READ, WRITE) to permit a fancy data input 
[and output] - and for the debugger.


Due to DW_TAG_namelist, namelists are now exposed to the middle end - 
and I forgot to handle them also in the tree pretty printer - hence 
-fdump-tree-original now ICEs.


For the pretty printer one has two options: Ignoring (or NYI;) the 
decl or dumping it. The attached patch does the latter.


Bootstrapped (C/C++/Fortran) and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias
2014-02-26  Tobias Burnus  bur...@net-b.de

	PR middle-end/60147
	* tree-pretty-print.c (dump_generic_node): Handle
	NAMELIST_DECL.

diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 0595499..0d46a1c 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -1720,7 +1720,16 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
 
 	  for (op0 = BIND_EXPR_VARS (node); op0; op0 = DECL_CHAIN (op0))
 		{
-		  print_declaration (buffer, op0, spc+2, flags);
+		  if (TREE_CODE(op0) == NAMELIST_DECL)
+		{
+		  INDENT (spc+2);
+		  pp_string (buffer, namelist /);
+		  dump_decl_name (buffer, op0, flags);
+		  pp_string (buffer, /);
+		  pp_semicolon (buffer);
+		}
+		  else
+		print_declaration (buffer, op0, spc+2, flags);
 		  pp_newline (buffer);
 		}
 	}


[GOOGLE] call compute_inline_parameters before early_inliner

2014-02-26 Thread Dehao Chen
This patch fixes the bug of not calling compute_inline_parameters
before early_inliner, which would lead to ICE.

Testing on going, OK for google-4_8 if test passes?

Thanks,
Dehao

Index: gcc/auto-profile.c
===
--- gcc/auto-profile.c (revision 207970)
+++ gcc/auto-profile.c (working copy)
@@ -1533,6 +1533,8 @@ auto_profile (void)
   early_inliner ();
  }

+  compute_inline_parameters (cgraph_get_node (current_function_decl),
+ false);
   early_inliner ();
   autofdo::afdo_annotate_cfg (promoted_stmts);
   compute_function_frequency ();


Re: [GOOGLE] call compute_inline_parameters before early_inliner

2014-02-26 Thread Xinliang David Li
On Wed, Feb 26, 2014 at 3:23 PM, Dehao Chen de...@google.com wrote:
 This patch fixes the bug of not calling compute_inline_parameters
 before early_inliner, which would lead to ICE.

 Testing on going, OK for google-4_8 if test passes?

 Thanks,
 Dehao

 Index: gcc/auto-profile.c
 ===
 --- gcc/auto-profile.c (revision 207970)
 +++ gcc/auto-profile.c (working copy)
 @@ -1533,6 +1533,8 @@ auto_profile (void)
early_inliner ();
   }

 +  compute_inline_parameters (cgraph_get_node (current_function_decl),
 + false);

false -- true ?

David

early_inliner ();
autofdo::afdo_annotate_cfg (promoted_stmts);
compute_function_frequency ();


Re: C++ PATCH for lto/53808 (devirtualization of defaulted virtual dtor)

2014-02-26 Thread Jan Hubicka
 But this caused bug 60347: turns out that we shouldn't do this
 unless the vtable (and thus the contents of the vtable) are used.

The ipa-devirt type inheritance builder will use any vtable it finds in 
DECL_BINFO
of types that it knows about. It starts with types of virtual methods and 
virtual tables
in the symbol table (so we should be sure that TREE_USED is set for vtable that 
is
associated with virtual method is set when virtual method itself is used).
But it will drop in also all base types of those types and then it will take 
types
found in OBJ_TYPE_REF  types from variables and type arguments.

Are all those safe?  I tried to describe this in
http://hubicka.blogspot.ca/2014/02/devirtualization-in-c-part-3-building.html

Honza


Re: [GOOGLE] call compute_inline_parameters before early_inliner

2014-02-26 Thread Dehao Chen
Yes, patch updated:

Index: gcc/auto-profile.c
===
--- gcc/auto-profile.c (revision 207970)
+++ gcc/auto-profile.c (working copy)
@@ -1371,8 +1371,7 @@ afdo_vpt_for_early_inline (stmt_set *promoted_stmt
   calculate_dominance_info (CDI_DOMINATORS);
   rebuild_cgraph_edges ();
   update_ssa (TODO_update_ssa);
-  compute_inline_parameters (cgraph_get_node (current_function_decl),
- false);
+  compute_inline_parameters (cgraph_get_node
(current_function_decl), true);
   return true;
 }
   else
@@ -1533,6 +1532,7 @@ auto_profile (void)
   early_inliner ();
  }

+  compute_inline_parameters (cgraph_get_node
(current_function_decl), true);
   early_inliner ();
   autofdo::afdo_annotate_cfg (promoted_stmts);
   compute_function_frequency ();

Dehao

On Wed, Feb 26, 2014 at 3:25 PM, Xinliang David Li davi...@google.com wrote:
 On Wed, Feb 26, 2014 at 3:23 PM, Dehao Chen de...@google.com wrote:
 This patch fixes the bug of not calling compute_inline_parameters
 before early_inliner, which would lead to ICE.

 Testing on going, OK for google-4_8 if test passes?

 Thanks,
 Dehao

 Index: gcc/auto-profile.c
 ===
 --- gcc/auto-profile.c (revision 207970)
 +++ gcc/auto-profile.c (working copy)
 @@ -1533,6 +1533,8 @@ auto_profile (void)
early_inliner ();
   }

 +  compute_inline_parameters (cgraph_get_node (current_function_decl),
 + false);

 false -- true ?

 David

early_inliner ();
autofdo::afdo_annotate_cfg (promoted_stmts);
compute_function_frequency ();


Re: [GOOGLE] call compute_inline_parameters before early_inliner

2014-02-26 Thread Xinliang David Li
ok.

David

On Wed, Feb 26, 2014 at 3:43 PM, Dehao Chen de...@google.com wrote:
 Yes, patch updated:

 Index: gcc/auto-profile.c
 ===
 --- gcc/auto-profile.c (revision 207970)
 +++ gcc/auto-profile.c (working copy)
 @@ -1371,8 +1371,7 @@ afdo_vpt_for_early_inline (stmt_set *promoted_stmt
calculate_dominance_info (CDI_DOMINATORS);
rebuild_cgraph_edges ();
update_ssa (TODO_update_ssa);
 -  compute_inline_parameters (cgraph_get_node (current_function_decl),
 - false);
 +  compute_inline_parameters (cgraph_get_node
 (current_function_decl), true);
return true;
  }
else
 @@ -1533,6 +1532,7 @@ auto_profile (void)
early_inliner ();
   }

 +  compute_inline_parameters (cgraph_get_node
 (current_function_decl), true);
early_inliner ();
autofdo::afdo_annotate_cfg (promoted_stmts);
compute_function_frequency ();

 Dehao

 On Wed, Feb 26, 2014 at 3:25 PM, Xinliang David Li davi...@google.com wrote:
 On Wed, Feb 26, 2014 at 3:23 PM, Dehao Chen de...@google.com wrote:
 This patch fixes the bug of not calling compute_inline_parameters
 before early_inliner, which would lead to ICE.

 Testing on going, OK for google-4_8 if test passes?

 Thanks,
 Dehao

 Index: gcc/auto-profile.c
 ===
 --- gcc/auto-profile.c (revision 207970)
 +++ gcc/auto-profile.c (working copy)
 @@ -1533,6 +1533,8 @@ auto_profile (void)
early_inliner ();
   }

 +  compute_inline_parameters (cgraph_get_node (current_function_decl),
 + false);

 false -- true ?

 David

early_inliner ();
autofdo::afdo_annotate_cfg (promoted_stmts);
compute_function_frequency ();


RE: [Patch, testsuite]: Allow MicroBlaze .weakext pattern in regex match

2014-02-26 Thread David Holsgrove
Hi Mike S., Michael E.,

 -Original Message-
 From: Mike Stump [mailto:mikest...@comcast.net]
 Sent: Friday, 21 February 2014 6:17 am
 To: David Holsgrove
 Cc: gcc-patches@gcc.gnu.org; Michael Eager (ea...@eagerm.com); Vidhumouli
 Hunsigida; Nagaraju Mekala; John Williams; Edgar Iglesias
 Subject: Re: [Patch, testsuite]: Allow MicroBlaze .weakext pattern in regex 
 match
 
 On Feb 16, 2014, at 4:21 PM, David Holsgrove david.holsgr...@xilinx.com
 wrote:
  I've attached an updated patch
 
 Ok, thanks.

If no one has any objections on this updated patch, would either of you be able 
to approve and apply?

thanks,
David




Re: [PATCH] Change HONOR_REG_ALLOC_ORDER to a marco for C expression

2014-02-26 Thread Kito Cheng
Hi all:

Sorry for repeat patch content in last mail, here is the clean version
for this patch.

diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 7ca47a7..1638332 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1152,7 +1152,7 @@ extern int arm_regs_in_sequence[];

 /* Tell IRA to use the order we define rather than messing it up with its
own cost calculations.  */
-#define HONOR_REG_ALLOC_ORDER
+#define HONOR_REG_ALLOC_ORDER 1

 /* Interrupt functions can only use registers that have already been
saved by the prologue, even if they would normally be
diff --git a/gcc/config/nds32/nds32.h b/gcc/config/nds32/nds32.h
index 38847e5..8f966ec 100644
--- a/gcc/config/nds32/nds32.h
+++ b/gcc/config/nds32/nds32.h
@@ -553,7 +553,7 @@ enum nds32_builtins

 /* Tell IRA to use the order we define rather than messing it up with its
own cost calculations.  */
-#define HONOR_REG_ALLOC_ORDER
+#define HONOR_REG_ALLOC_ORDER 1

 /* The number of consecutive hard regs needed starting at
reg regno for holding a value of mode mode.  */
diff --git a/gcc/defaults.h b/gcc/defaults.h
index f94ae17..1c48759 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1085,6 +1085,10 @@ see the files COPYING3 and COPYING.RUNTIME
respectively.  If not, see
 #define LOCAL_REGNO(REGNO)  0
 #endif

+#ifndef HONOR_REG_ALLOC_ORDER
+#define HONOR_REG_ALLOC_ORDER 0
+#endif
+
 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
the stack pointer does not matter.  The value is tested only in
functions that have frame pointers.  */
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index f204936..c0de478 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -2044,8 +2044,8 @@ Normally, IRA tries to estimate the costs for
saving a register in the
 prologue and restoring it in the epilogue.  This discourages it from
 using call-saved registers.  If a machine wants to ensure that IRA
 allocates registers in the order given by REG_ALLOC_ORDER even if some
-call-saved registers appear earlier than call-used ones, this macro
-should be defined.
+call-saved registers appear earlier than call-used ones, then define this
+ macro as a C expression to nonzero. Default is 0.
 @end defmac

 @defmac IRA_HARD_REGNO_ADD_COST_MULTIPLIER (@var{regno})
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 50f412c..d7ae6a7 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -1849,8 +1849,8 @@ Normally, IRA tries to estimate the costs for
saving a register in the
 prologue and restoring it in the epilogue.  This discourages it from
 using call-saved registers.  If a machine wants to ensure that IRA
 allocates registers in the order given by REG_ALLOC_ORDER even if some
-call-saved registers appear earlier than call-used ones, this macro
-should be defined.
+call-saved registers appear earlier than call-used ones, then define this
+ macro as a C expression to nonzero. Default is 0.
 @end defmac

 @defmac IRA_HARD_REGNO_ADD_COST_MULTIPLIER (@var{regno})
diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index c20aaf7..773c86e 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -1599,7 +1599,6 @@ check_hard_reg_p (ira_allocno_t a, int hard_regno,
 }
   return j == nregs;
 }
-#ifndef HONOR_REG_ALLOC_ORDER

 /* Return number of registers needed to be saved and restored at
function prologue/epilogue if we allocate HARD_REGNO to hold value
@@ -1618,7 +1617,6 @@ calculate_saved_nregs (int hard_regno, enum
machine_mode mode)
   nregs++;
   return nregs;
 }
-#endif

 /* Choose a hard register for allocno A.  If RETRY_P is TRUE, it means
that the function called from function
@@ -1653,11 +1651,9 @@ assign_hard_reg (ira_allocno_t a, bool retry_p)
   enum reg_class aclass;
   enum machine_mode mode;
   static int costs[FIRST_PSEUDO_REGISTER], full_costs[FIRST_PSEUDO_REGISTER];
-#ifndef HONOR_REG_ALLOC_ORDER
   int saved_nregs;
   enum reg_class rclass;
   int add_cost;
-#endif
 #ifdef STACK_REGS
   bool no_stack_reg_p;
 #endif
@@ -1823,19 +1819,21 @@ assign_hard_reg (ira_allocno_t a, bool retry_p)
  continue;
   cost = costs[i];
   full_cost = full_costs[i];
-#ifndef HONOR_REG_ALLOC_ORDER
-  if ((saved_nregs = calculate_saved_nregs (hard_regno, mode)) != 0)
- /* We need to save/restore the hard register in
-   epilogue/prologue.  Therefore we increase the cost.  */
- {
-  rclass = REGNO_REG_CLASS (hard_regno);
-  add_cost = ((ira_memory_move_cost[mode][rclass][0]
-   + ira_memory_move_cost[mode][rclass][1])
-  * saved_nregs / hard_regno_nregs[hard_regno][mode] - 1);
-  cost += add_cost;
-  full_cost += add_cost;
- }
-#endif
+
+  if (!HONOR_REG_ALLOC_ORDER) {
+ if ((saved_nregs = calculate_saved_nregs (hard_regno, mode)) != 0)
+  /* We need to save/restore the hard register in
+ epilogue/prologue.  Therefore we increase the cost.  */
+  {
+rclass = REGNO_REG_CLASS (hard_regno);
+add_cost = ((ira_memory_move_cost[mode][rclass][0]
+ + 

copyright dates in binutils (and includes/)

2014-02-26 Thread Alan Modra
I've been hacking gcc's contrib/update-copyright.py for binutils,
and have run it over binutils to update all the binutils copyright
notices.

Here's an example of the update:

--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -1,7 +1,5 @@
 /* SPARC-specific support for 32-bit ELF
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright (C) 1993-2014 Free Software Foundation, Inc.
 
This file is part of BFD, the Binary File Descriptor library.
 
Does anyone have a violent objection to committing updates in
bfd, binutils, elfcpp, gas, gold, gprof, ld, and opcodes?

How about includes/ too?  The choices there are
a) apply to just binutils owned files, 
b) apply to binutils+gdb files,
c) apply to the lot, and update gcc/include/ too.

I see Joel already updated include/gdb, but the script makes a further
small change.  So choice (b) in include/gdb consists of patches like
the following:

diff --git a/include/gdb/gdb-index.h b/include/gdb/gdb-index.h
index d846b04..a8d4f2f 100644
--- a/include/gdb/gdb-index.h
+++ b/include/gdb/gdb-index.h
@@ -1,5 +1,5 @@
 /* Public attributes of the .gdb_index section.
-   Copyright 2012-2014 Free Software Foundation, Inc.
+   Copyright (C) 2012-2014 Free Software Foundation, Inc.
 
This file is part of GDB.
 
-- 
Alan Modra
Australia Development Lab, IBM


[PR debug/57232] don't record non-fixed reg as CFA base value

2014-02-26 Thread Alexandre Oliva
Some ports were failing an assertion check that was supposed to make
sure some RTX created a new VALUE, rather than reuse an existing one in
the cselib tables.  The reason the value was already there was that we'd
recorded the register in the permanent table as the CFA, but the
register was correctly used for other purposes by the compiler itself,
we'd just failed to refrain from take note of that in this particular
code path.  Other paths that register the CFA base value are guarded by
this condition, and guarding this one fixed the problem on the affected
ports.

Regstrapped on x86_64-linux-gnu and i686-linux-gnu; in the PR, the
problem is confirmed fixed by this patch on the rx and lm32 ports too.
Ok?


for  gcc/ChangeLog

PR debug/57232
* var-tracking.c (vt_initialize): Apply the same condition to
preserve the CFA base value.
---
 gcc/var-tracking.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index c5ce1dd..65d8285 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -9924,7 +9924,8 @@ vt_initialize (void)
   val = cselib_lookup_from_insn (reg, GET_MODE (reg), 1,
 VOIDmode, get_insns ());
   preserve_value (val);
-  cselib_preserve_cfa_base_value (val, REGNO (reg));
+  if (reg != hard_frame_pointer_rtx  fixed_regs[REGNO (reg)])
+   cselib_preserve_cfa_base_value (val, REGNO (reg));
   expr = plus_constant (GET_MODE (stack_pointer_rtx),
stack_pointer_rtx, -ofst);
   cselib_add_permanent_equiv (val, expr, get_insns ());


-- 
Alexandre Oliva, freedom fighterhttp://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist Red Hat Brazil Toolchain Engineer


RE: [PATCH][4.8] Backport strict-volatile-bitfields fixes to 4.8

2014-02-26 Thread Joey Ye
Ping ^ 5

 -Original Message-
 From: Joey Ye [mailto:joey...@arm.com]
 Sent: 19 February 2014 17:22
 To: 'ja...@redhat.com'; gcc-patches@gcc.gnu.org
 Subject: RE: [PATCH][4.8] Backport strict-volatile-bitfields fixes to 4.8
 
 Ping ^ 4
 
  -Original Message-
  From: Joey Ye [mailto:joey...@arm.com]
  Sent: Friday, February 14, 2014 9:58
  To: gcc-patches@gcc.gnu.org
  Subject: RE: [PATCH][4.8] Backport strict-volatile-bitfields fixes to
  4.8
 
  Ping ^3
 
  These fixes are very important to 4.8 ARM embedded users, as they rely
  on strict volatile bitfields a lot. Please let them in 4.8.
 
   -Original Message-
   From: Joey Ye [mailto:joey...@arm.com]
   Sent: Saturday, February 08, 2014 10:42
   To: gcc-patches@gcc.gnu.org
   Subject: RE: [PATCH][4.8] Backport strict-volatile-bitfields fixes
   to
   4.8
  
   Ping ^ 2
  
   OK to 4.8?
  
-Original Message-
From: Joey Ye [mailto:joey...@arm.com]
Sent: Monday, January 20, 2014 10:47
To: gcc-patches@gcc.gnu.org
Subject: RE: [PATCH][4.8] Backport strict-volatile-bitfields fixes
to 4.8
   
Ping
   
 -Original Message-
 From: Joey Ye [mailto:joey...@arm.com]
 Sent: Thursday, January 16, 2014 16:28
 To: gcc-patches@gcc.gnu.org
 Subject: [PATCH][4.8] Backport strict-volatile-bitfields fixes
 to
 4.8

 4.8 has a number of strict-volatile-bitfields issues that can be
 fixed by following patches.
 trunk@205899, 205898, 205897, 205896, 203003

 Tested on x86_64 and arm without regression.

 OK to 4.8?

 2013-09-28  Sandra Loosemore  san...@codesourcery.com

 gcc/
 * expr.h (extract_bit_field): Remove packedp parameter.
 * expmed.c (extract_fixed_bit_field): Remove packedp
 parameter
 from forward declaration.
 (store_split_bit_field): Remove packedp arg from calls to
 extract_fixed_bit_field.
 (extract_bit_field_1): Remove packedp parameter and
packedp
 argument from recursive calls and calls to
extract_fixed_bit_field.
 (extract_bit_field): Remove packedp parameter and
 corresponding
 arg to extract_bit_field_1.
 (extract_fixed_bit_field): Remove packedp parameter.
 Remove
   code
 to issue warnings.
 (extract_split_bit_field): Remove packedp arg from call to
 extract_fixed_bit_field.
 * expr.c (emit_group_load_1): Adjust calls to
extract_bit_field.
 (copy_blkmode_from_reg): Likewise.
 (copy_blkmode_to_reg): Likewise.
 (read_complex_part): Likewise.
 (store_field): Likewise.
 (expand_expr_real_1): Likewise.
 * calls.c (store_unaligned_arguments_into_pseudos): Adjust
call
 to extract_bit_field.
 * config/tilegx/tilegx.c (tilegx_expand_unaligned_load):
Adjust
 call to extract_bit_field.
 * config/tilepro/tilepro.c
(tilepro_expand_unaligned_load):
 Adjust
 call to extract_bit_field.
 * doc/invoke.texi (Code Gen Options): Remove mention of
  warnings
 and special packedp behavior from
-fstrict-volatile-bitfields
 documentation.

 2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de

 * expr.c (expand_assignment): Remove dependency on
 flag_strict_volatile_bitfields. Always set the memory
 access mode.
 (expand_expr_real_1): Likewise.

 2013-12-11  Sandra Loosemore  san...@codesourcery.com

 PR middle-end/23623
 PR middle-end/48784
 PR middle-end/56341
 PR middle-end/56997

 gcc/
 * expmed.c (strict_volatile_bitfield_p): New function.
 (store_bit_field_1): Don't special-case strict volatile
 bitfields here.
 (store_bit_field): Handle strict volatile bitfields here
instead.
 (store_fixed_bit_field): Don't special-case strict
volatile
 bitfields here.
 (extract_bit_field_1): Don't special-case strict volatile
 bitfields here.
 (extract_bit_field): Handle strict volatile bitfields here
instead.
 (extract_fixed_bit_field): Don't special-case strict
volatile
 bitfields here.  Simplify surrounding code to resemble
that in
 store_fixed_bit_field.
 * doc/invoke.texi (Code Gen Options): Update
 -fstrict-volatile-bitfields description.

 gcc/testsuite/
 * gcc.dg/pr23623.c: New test.
 * gcc.dg/pr48784-1.c: New test.
 * gcc.dg/pr48784-2.c: New test.
 * gcc.dg/pr56341-1.c: New test.
 * gcc.dg/pr56341-2.c: New test.
 * gcc.dg/pr56997-1.c: New test.
 * gcc.dg/pr56997-2.c: New test.
 * 

[PR debug/59992 #1/2] avoid quadratic behavior for the removal of useless values

2014-02-26 Thread Alexandre Oliva
We indirectly call remove_useless_values quite often during
vt_initialize; at least once per extended basic block.  On functions
with thousands of small basic blocks, each adding permanent and
temporary entries to the table, that turns out to be quite expensive:
the permanent entries pile up and trigger the quadratic behavior
mentioned in teh guard of one of the two calls of remove_useless_values.
This patch moves the guard so that it applies to the other as well.

I wasn't entirely sure this wouldn't invalidate assumptions made in
callers of cselib_preserve_only_values (the function called at the end
of each extended basic block), but some analysis, plus comparing before
and after assembly output ;-), made sure it didn't ;-)

This patch alone cut down the vt_initialize time of insn-recog on
generic i686 from more than 1700 seconds (~84% of the total compile
time) to about 500 seconds.

Regstrapped on x86_64-linux-gnu and i686-linux-gnu, along with the other
patch for PR debug/59992 that I'm about to post.


for  gcc/ChangeLog

PR debug/59992
* cselib.c (remove_useless_values): Skip to avoid quadratic
behavior if the condition moved from...
(cselib_process_insn): ... here holds.
---
 gcc/cselib.c |   16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/gcc/cselib.c b/gcc/cselib.c
index 525e717..dabd2d3 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -662,6 +662,14 @@ remove_useless_values (void)
 {
   cselib_val **p, *v;
 
+  if (n_useless_values = MAX_USELESS_VALUES
+  /* remove_useless_values is linear in the hash table size.  Avoid
+ quadratic behavior for very large hashtables with very few
+useless elements.  */
+  || ((unsigned int)n_useless_values
+ = (cselib_hash_table.elements () - n_debug_values) / 4))
+return;
+
   /* First pass: eliminate locations that reference the value.  That in
  turn can make more values useless.  */
   do
@@ -2693,13 +2701,7 @@ cselib_process_insn (rtx insn)
 
   cselib_current_insn = NULL_RTX;
 
-  if (n_useless_values  MAX_USELESS_VALUES
-  /* remove_useless_values is linear in the hash table size.  Avoid
- quadratic behavior for very large hashtables with very few
-useless elements.  */
-   ((unsigned int)n_useless_values
-  (cselib_hash_table.elements () - n_debug_values) / 4))
-remove_useless_values ();
+  remove_useless_values ();
 }
 
 /* Initialize cselib for one pass.  The caller must also call

-- 
Alexandre Oliva, freedom fighterhttp://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist Red Hat Brazil Toolchain Engineer


[PR debug/59992 #2/2] preserve permanent values in a separate table

2014-02-26 Thread Alexandre Oliva
[apologies if this is a dupe; I accidentally hit the send keystroke
 before adding the last paragraph, and I'm not sure I was quick enough
 to cancel it]

The first patch for PR debug/59992 cut down vt_initialize time in
insn-recog to less than 1/3, by avoiding quadratic behavior in
remove_useless_values, but the affected calls were always followed by
cselib_reset_table, which would also iterate over the entire table
looking for non-constant non-permanent values to remove.  That was not
just redundant, but quadratic as well.

What's worse is that, unlike remove_useless_values, this is a cleanup
that we really have to do at the end of extended basic blocks, but for
large functions, most of the entries in the table are going to be
preserved values that we're going to visit over and over, but never
remove.

Instead of creating a list of recently-created values to revisit, I
figured it would be smarter to move the preserved values to a separate
table, that won't have to be cleaned up till we're through with the
function.  Lookups first search the permanent table (if it's enabled,
i.e., only in var-tracking), always without insertion (we only insert in
the original table), and that's all it took to make it work, again
without any change to the asm output for i686 insn-recog.

The patch turned out to be quite easy and safe, and it cut down
vt_initialize time in i686 insn-recog from 500 seconds to only 5
seconds.

Regstrapped on x86_64-linux-gnu and i686-linux-gnu, along with the other
patch for PR debug/59992.  Ok to install?


for  gcc/ChangeLog

PR debug/59992
* cselib.c (cselib_hasher::equal): Special-case VALUE lookup.
(cselib_preserved_hash_table): New.
(preserve_constants_and_equivs): Move preserved vals to it.
(cselib_find_slot): Look it up first.
(cselib_init): Initialize it.
(cselib_finish): Release it.
(dump_cselib_table): Dump it.
---
 gcc/cselib.c |   34 ++
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/gcc/cselib.c b/gcc/cselib.c
index dabd2d3..0fcfe28 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -132,6 +132,9 @@ cselib_hasher::equal (const value_type *v, const 
compare_type *x_arg)
  || GET_CODE (XEXP (x, 0)) == CONST_FIXED))
 x = XEXP (x, 0);
 
+  if (GET_CODE (x) == VALUE)
+return x == v-val_rtx;
+
   /* We don't guarantee that distinct rtx's have different hash values,
  so we need to do a comparison.  */
   for (l = v-locs; l; l = l-next)
@@ -147,6 +150,9 @@ cselib_hasher::equal (const value_type *v, const 
compare_type *x_arg)
 /* A table that enables us to look up elts by their value.  */
 static hash_table cselib_hasher cselib_hash_table;
 
+/* A table to hold preserved values.  */
+static hash_table cselib_hasher cselib_preserved_hash_table;
+
 /* This is a global so we don't have to pass this through every function.
It is used in new_elt_loc_list to set SETTING_INSN.  */
 static rtx cselib_current_insn;
@@ -490,8 +496,17 @@ preserve_constants_and_equivs (cselib_val **x, void *info 
ATTRIBUTE_UNUSED)
 {
   cselib_val *v = *x;
 
-  if (!invariant_or_equiv_p (v))
-cselib_hash_table.clear_slot (x);
+  if (invariant_or_equiv_p (v))
+{
+  cselib_val **slot
+   = cselib_preserved_hash_table.find_slot_with_hash (v-val_rtx,
+  v-hash, INSERT);
+  gcc_assert (!*slot);
+  *slot = v;
+}
+
+  cselib_hash_table.clear_slot (x);
+
   return 1;
 }
 
@@ -565,9 +580,13 @@ static cselib_val **
 cselib_find_slot (rtx x, hashval_t hash, enum insert_option insert,
  enum machine_mode memmode)
 {
-  cselib_val **slot;
+  cselib_val **slot = NULL;
   find_slot_memmode = memmode;
-  slot = cselib_hash_table.find_slot_with_hash (x, hash, insert);
+  if (cselib_preserve_constants)
+slot = cselib_preserved_hash_table.find_slot_with_hash (x, hash,
+   NO_INSERT);
+  if (!slot)
+slot = cselib_hash_table.find_slot_with_hash (x, hash, insert);
   find_slot_memmode = VOIDmode;
   return slot;
 }
@@ -2742,6 +2761,8 @@ cselib_init (int record_what)
   used_regs = XNEWVEC (unsigned int, cselib_nregs);
   n_used_regs = 0;
   cselib_hash_table.create (31);
+  if (cselib_preserve_constants)
+cselib_preserved_hash_table.create (31);
   next_uid = 1;
 }
 
@@ -2750,6 +2771,7 @@ cselib_init (int record_what)
 void
 cselib_finish (void)
 {
+  bool preserved = cselib_preserve_constants;
   cselib_discard_hook = NULL;
   cselib_preserve_constants = false;
   cselib_any_perm_equivs = false;
@@ -2761,6 +2783,8 @@ cselib_finish (void)
   free_alloc_pool (value_pool);
   cselib_clear_table ();
   cselib_hash_table.dispose ();
+  if (preserved)
+cselib_preserved_hash_table.dispose ();
   free (used_regs);
   used_regs = 0;
   n_useless_values = 0;
@@ -2850,6 +2874,8 @@ dump_cselib_table (FILE *out)
 {
   fprintf (out, cselib hash 

RE: [PATCH][4.8] Backport strict-volatile-bitfields fixes to 4.8

2014-02-26 Thread Joey Ye
Committed to ARM/embedded-4_8-branch

Still pending to gcc-4_8-branch.

 -Original Message-
 From: Joey Ye [mailto:joey...@arm.com]
 Sent: 27 February 2014 13:53
 To: 'ja...@redhat.com'; 'gcc-patches@gcc.gnu.org'
 Subject: RE: [PATCH][4.8] Backport strict-volatile-bitfields fixes to 4.8
 
 Ping ^ 5
 
  -Original Message-
  From: Joey Ye [mailto:joey...@arm.com]
  Sent: 19 February 2014 17:22
  To: 'ja...@redhat.com'; gcc-patches@gcc.gnu.org
  Subject: RE: [PATCH][4.8] Backport strict-volatile-bitfields fixes to
  4.8
 
  Ping ^ 4
 
   -Original Message-
   From: Joey Ye [mailto:joey...@arm.com]
   Sent: Friday, February 14, 2014 9:58
   To: gcc-patches@gcc.gnu.org
   Subject: RE: [PATCH][4.8] Backport strict-volatile-bitfields fixes
   to
   4.8
  
   Ping ^3
  
   These fixes are very important to 4.8 ARM embedded users, as they
   rely on strict volatile bitfields a lot. Please let them in 4.8.
  
-Original Message-
From: Joey Ye [mailto:joey...@arm.com]
Sent: Saturday, February 08, 2014 10:42
To: gcc-patches@gcc.gnu.org
Subject: RE: [PATCH][4.8] Backport strict-volatile-bitfields fixes
to
4.8
   
Ping ^ 2
   
OK to 4.8?
   
 -Original Message-
 From: Joey Ye [mailto:joey...@arm.com]
 Sent: Monday, January 20, 2014 10:47
 To: gcc-patches@gcc.gnu.org
 Subject: RE: [PATCH][4.8] Backport strict-volatile-bitfields
 fixes to 4.8

 Ping

  -Original Message-
  From: Joey Ye [mailto:joey...@arm.com]
  Sent: Thursday, January 16, 2014 16:28
  To: gcc-patches@gcc.gnu.org
  Subject: [PATCH][4.8] Backport strict-volatile-bitfields fixes
  to
  4.8
 
  4.8 has a number of strict-volatile-bitfields issues that can
  be fixed by following patches.
  trunk@205899, 205898, 205897, 205896, 203003
 
  Tested on x86_64 and arm without regression.
 
  OK to 4.8?
 
  2013-09-28  Sandra Loosemore  san...@codesourcery.com
 
  gcc/
  * expr.h (extract_bit_field): Remove packedp parameter.
  * expmed.c (extract_fixed_bit_field): Remove packedp
  parameter
  from forward declaration.
  (store_split_bit_field): Remove packedp arg from calls
to
  extract_fixed_bit_field.
  (extract_bit_field_1): Remove packedp parameter and
packedp
  argument from recursive calls and calls to
 extract_fixed_bit_field.
  (extract_bit_field): Remove packedp parameter and
  corresponding
  arg to extract_bit_field_1.
  (extract_fixed_bit_field): Remove packedp parameter.
  Remove
code
  to issue warnings.
  (extract_split_bit_field): Remove packedp arg from call
to
  extract_fixed_bit_field.
  * expr.c (emit_group_load_1): Adjust calls to
extract_bit_field.
  (copy_blkmode_from_reg): Likewise.
  (copy_blkmode_to_reg): Likewise.
  (read_complex_part): Likewise.
  (store_field): Likewise.
  (expand_expr_real_1): Likewise.
  * calls.c (store_unaligned_arguments_into_pseudos):
Adjust
 call
  to extract_bit_field.
  * config/tilegx/tilegx.c (tilegx_expand_unaligned_load):
Adjust
  call to extract_bit_field.
  * config/tilepro/tilepro.c
(tilepro_expand_unaligned_load):
  Adjust
  call to extract_bit_field.
  * doc/invoke.texi (Code Gen Options): Remove mention
  of
   warnings
  and special packedp behavior from
-fstrict-volatile-bitfields
  documentation.
 
  2013-12-11  Bernd Edlinger  bernd.edlin...@hotmail.de
 
  * expr.c (expand_assignment): Remove dependency on
  flag_strict_volatile_bitfields. Always set the memory
  access mode.
  (expand_expr_real_1): Likewise.
 
  2013-12-11  Sandra Loosemore  san...@codesourcery.com
 
  PR middle-end/23623
  PR middle-end/48784
  PR middle-end/56341
  PR middle-end/56997
 
  gcc/
  * expmed.c (strict_volatile_bitfield_p): New function.
  (store_bit_field_1): Don't special-case strict volatile
  bitfields here.
  (store_bit_field): Handle strict volatile bitfields here
instead.
  (store_fixed_bit_field): Don't special-case strict
volatile
  bitfields here.
  (extract_bit_field_1): Don't special-case strict
volatile
  bitfields here.
  (extract_bit_field): Handle strict volatile bitfields
here instead.
  (extract_fixed_bit_field): Don't special-case strict
volatile
  bitfields here.  Simplify surrounding code to resemble
that in
  store_fixed_bit_field.
  * doc/invoke.texi (Code Gen 

<    1   2