Re: [patch c++]: Fix type_info struct for llp64 targets

2012-12-27 Thread Kai Tietz
Ping

2012/12/21 Kai Tietz ktiet...@googlemail.com:
 Hello,

 this patch fixes the layout of the info_type-s for llp64 target.  We
 used here 'long' type instead
 of pointer-scalar-witdth type.  That's an issue for llp64 targets.
 I introduced for that the LONGPTR_T helper-macro, which has either
 scalar-size of 'long' type, or
 of 'long long' type's size, if pointer is larger then scalar-size of
 'long' type.

 ChangeLog

 2012-12-21  Kai Tietz

 * rtti.c (LONGPTR_T): New helper-macro.
 (get_pseudo_ti_init): Initialize offset_type by LONGPTR_T
 type instead of 'long' type.
 (create_tinfo_types): Use for offset/flags field LONGPTR_T
 type instead of 'long' type.

 Tested for x86_64-w64-mingw32, i686-w64-mingw32, and
 x86_64-unknown-linux-gnu.  Ok for apply?

 Regards,
 Kai

 Index: rtti.c
 ===
 --- rtti.c  (Revision 194660)
 +++ rtti.c  (Arbeitskopie)
 @@ -89,6 +89,12 @@ typedef enum tinfo_kind
/* ...  abi::__vmi_type_infoI */
  } tinfo_kind;

 +/* Helper macro to get maximum scalar-width of pointer or of the 'long'-type.
 +   This of interest for llp64 targets.  */
 +#define LONGPTR_T \
 +  integer_types[(POINTER_SIZE = TYPE_PRECISION (integer_types[itk_long]) \
 +? itk_long : itk_long_long)]
 +
  /* A vector of all tinfo decls that haven't yet been emitted.  */
  vectree, va_gc *unemitted_tinfo_decls;

 @@ -1116,7 +1122,7 @@ get_pseudo_ti_init (tree type, unsigned tk_index)
 tree binfo = TYPE_BINFO (type);
 int nbases = BINFO_N_BASE_BINFOS (binfo);
 vectree, va_gc *base_accesses = BINFO_BASE_ACCESSES (binfo);
 -   tree offset_type = integer_types[itk_long];
 +   tree offset_type = LONGPTR_T;
 tree base_inits = NULL_TREE;
 int ix;
 vecconstructor_elt, va_gc *init_vec = NULL;
 @@ -1413,14 +1419,15 @@ create_tinfo_types (void)
/* Base class internal helper. Pointer to base type, offset to base,
   flags.  */
{
 -tree field, fields;
 +tree field, fields, offset_flags_type;

  field = build_decl (BUILTINS_LOCATION,
 FIELD_DECL, NULL_TREE, type_info_ptr_type);
  fields = field;

 +offset_flags_type = LONGPTR_T;
  field = build_decl (BUILTINS_LOCATION,
 -   FIELD_DECL, NULL_TREE, integer_types[itk_long]);
 +   FIELD_DECL, NULL_TREE, offset_flags_type);
  DECL_CHAIN (field) = fields;
  fields = field;



-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| ()_() him gain world domination


Re: [RFC PATCH, i386]: Use %r15 for REAL_PIC_OFFSET_TABLE_REGNUM on x86_64

2012-12-27 Thread Uros Bizjak
On Wed, Dec 26, 2012 at 9:16 PM, Andi Kleen a...@firstfloor.org wrote:
 Can you please post a real-world example, where using %r15 would break
 existing code?

 I used to run into problems like this when porting code to gcc from icc or VC.
 A lot of hyper optimized inline assembler snippets wants to use all registers
 and icc/VC support that. With gcc usually had to add some manual
 push/pops. In older gcc versions usually more than one because reload
 tended to error out otherwise.

 So by try and error used the non fixed registers, but let the compiler know
 about the others. This case would break.

 In 64bit it was less a problem than on 32bit, but could still happen.

 Admittedly medium is somewhat obscure and rarely used (and very slow),
 but someone could be still using it.

The alternative approach is changing cpuid definition in cpuid.h (as
in attached patch) to preserve %rbx, but we can't detect various code
model settings there. Since the change depends on the definition of
__PIC__, we unnecessary preserve %rbx also for -mcmodel=small.
However, code that involves cpuid is rarely performance critical, so
perhaps we can live with this tradeoff.

IMO, this patch can be used on 4.7 branch, too.

Uros.


Re: [RFC PATCH, i386]: Use %r15 for REAL_PIC_OFFSET_TABLE_REGNUM on x86_64

2012-12-27 Thread Uros Bizjak
On Thu, Dec 27, 2012 at 9:08 AM, Uros Bizjak ubiz...@gmail.com wrote:
 On Wed, Dec 26, 2012 at 9:16 PM, Andi Kleen a...@firstfloor.org wrote:
 Can you please post a real-world example, where using %r15 would break
 existing code?

 I used to run into problems like this when porting code to gcc from icc or 
 VC.
 A lot of hyper optimized inline assembler snippets wants to use all registers
 and icc/VC support that. With gcc usually had to add some manual
 push/pops. In older gcc versions usually more than one because reload
 tended to error out otherwise.

 So by try and error used the non fixed registers, but let the compiler know
 about the others. This case would break.

 In 64bit it was less a problem than on 32bit, but could still happen.

 Admittedly medium is somewhat obscure and rarely used (and very slow),
 but someone could be still using it.

 The alternative approach is changing cpuid definition in cpuid.h (as
 in attached patch) to preserve %rbx, but we can't detect various code
 model settings there. Since the change depends on the definition of
 __PIC__, we unnecessary preserve %rbx also for -mcmodel=small.
 However, code that involves cpuid is rarely performance critical, so
 perhaps we can live with this tradeoff.

 IMO, this patch can be used on 4.7 branch, too.

Now with the patch ...

Uros.
Index: i386/cpuid.h
===
--- i386/cpuid.h(revision 194723)
+++ i386/cpuid.h(working copy)
@@ -132,8 +132,9 @@
 #define signature_VORTEX_ecx   0x436f5320
 #define signature_VORTEX_edx   0x36387865
 
-#if defined(__i386__)  defined(__PIC__)
+#if defined(__PIC__)
 /* %ebx may be the PIC register.  */
+#if defined(__i386__)
 #if __GNUC__ = 3
 #define __cpuid(level, a, b, c, d) \
   __asm__ (xchg{l}\t{%%}ebx, %1\n\t  \
@@ -165,6 +166,21 @@
   : =a (a), =r (b), =c (c), =d (d) \
   : 0 (level), 2 (count))
 #endif
+#elif defined(__x86_64__)
+#define __cpuid(level, a, b, c, d) \
+  __asm__ (xchg{q}\t{%%}rbx, %q1\n\t \
+  cpuid\n\t  \
+  xchg{q}\t{%%}rbx, %q1\n\t  \
+  : =a (a), =r (b), =c (c), =d (d) \
+  : 0 (level))
+
+#define __cpuid_count(level, count, a, b, c, d)\
+  __asm__ (xchg{q}\t{%%}rbx, %q1\n\t \
+  cpuid\n\t  \
+  xchg{q}\t{%%}rbx, %q1\n\t  \
+  : =a (a), =r (b), =c (c), =d (d) \
+  : 0 (level), 2 (count))
+#endif
 #else
 #define __cpuid(level, a, b, c, d) \
   __asm__ (cpuid\n\t \


Re: [RFC PATCH, i386]: Use %r15 for REAL_PIC_OFFSET_TABLE_REGNUM on x86_64

2012-12-27 Thread Florian Weimer
* Uros Bizjak:

 +#elif defined(__x86_64__)
 +#define __cpuid(level, a, b, c, d)   \
 +  __asm__ (xchg{q}\t{%%}rbx, %q1\n\t   \
 +cpuid\n\t  \
 +xchg{q}\t{%%}rbx, %q1\n\t  \
 +: =a (a), =r (b), =c (c), =d (d) \
 +: 0 (level))
 +
 +#define __cpuid_count(level, count, a, b, c, d)  \
 +  __asm__ (xchg{q}\t{%%}rbx, %q1\n\t   \
 +cpuid\n\t  \
 +xchg{q}\t{%%}rbx, %q1\n\t  \
 +: =a (a), =r (b), =c (c), =d (d) \
 +: 0 (level), 2 (count))
 +#endif

Shouldn't the constraint for b be =r?


Re: [RFC PATCH, i386]: Use %r15 for REAL_PIC_OFFSET_TABLE_REGNUM on x86_64

2012-12-27 Thread Uros Bizjak
On Thu, Dec 27, 2012 at 10:10 AM, Florian Weimer f...@deneb.enyo.de wrote:
 * Uros Bizjak:

 +#elif defined(__x86_64__)
 +#define __cpuid(level, a, b, c, d)   \
 +  __asm__ (xchg{q}\t{%%}rbx, %q1\n\t   \
 +cpuid\n\t  \
 +xchg{q}\t{%%}rbx, %q1\n\t  \
 +: =a (a), =r (b), =c (c), =d (d) \
 +: 0 (level))
 +
 +#define __cpuid_count(level, count, a, b, c, d)  \
 +  __asm__ (xchg{q}\t{%%}rbx, %q1\n\t   \
 +cpuid\n\t  \
 +xchg{q}\t{%%}rbx, %q1\n\t  \
 +: =a (a), =r (b), =c (c), =d (d) \
 +: 0 (level), 2 (count))
 +#endif

 Shouldn't the constraint for b be =r?

Technically yes, but all input operands are matched to outputs, so in
practice it doesn't really matter.

Uros.


Re: [PATCH] Function Multiversioning Bug, checking for function versions

2012-12-27 Thread Andreas Schwab
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 148388d..575e03a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,7 @@
- .mine
+2012-12-27  Andreas Schwab  sch...@linux-m68k.org
+
+   * target.def (supports_function_versions): Fix typo.
+
 2012-12-26  Sriraman Tallam  tmsri...@google.com
 
* doc/tm.texi.in (TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS): Document
@@ -15,12 +18,10 @@
* (is_function_default_version): Check target string.
* TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS: New macro.
 
-===
 2012-12-27  Steven Bosscher  ste...@gcc.gnu.org
 
* cgraph.c (verify_cgraph_node): Don't allocate/free visited_nodes set.
 
- .r194729
 2012-12-25  John David Anglin  dave.ang...@nrc-cnrc.gc.ca
 
PR target/53789
diff --git a/gcc/target.def b/gcc/target.def
index 79bb955..d0547be 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -2839,7 +2839,7 @@ DEFHOOK
 (supports_function_versions,
  ,
  bool, (void),
- hool_bool_void_false)
+ hook_bool_void_false)
 
 /* Function to determine if one function can inline another function.  */
 #undef HOOK_PREFIX
-- 
1.8.0.2


-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.


Re: [patch, fortran] PR48976 INQUIRE with STREAM= not supported

2012-12-27 Thread Tobias Burnus

Dear Jerry,

thanks for the patch.However, I wonder about the following:

Will that be backward compatible with binaries compiled with GCC  4.8 
or will that cause problems? I have the feeling that it is okay as the 
flag (cf2) indicating whether stream= is present has still the same 
type and iqstream comes last in st_parameter_inquire and is only set 
if (cf2  IOPARM_INQUIRE_HAS_STREAM).


Can confirm that there is no backward-compatibility issue? If there 
isn't, the patch is okay.


Tobias

Jerry DeLisle wrote:

2012-12-27  Jerry DeLisle jvdeli...@gcc.gnu.org

PR fortran/48976
* gfortran.h (gfc_inquire struct): Add pointer for inquire stream.
* io.c (io_tag): Add tag for inquire stream. (match_inquire_element):
Add matcher for new tag. (gfc_resolve_inquire): Resolve new tag.
* ioparm.def: Add new parameter for inquire stream.
* trans-io.c (gfc_trans_inquire): Add tranlste code for inquire
stream.

2012-12-27  Jerry DeLisle jvdeli...@gcc.gnu.org

PR libfortran/48976
* io/inquire.c (inquire_via_unit): Set user stream inquiry 
variable to
appropriate value based on unit access method. 
(inquire_via_filename):
Since filename is not associated with an open unit, set stream 
inquiry

to UNKNOWN.
* io/io.h: Define inquire stream parameters.


Re: [Patch, libffi] libffi merge

2012-12-27 Thread Jack Howarth
On Wed, Dec 26, 2012 at 11:29:42AM -0500, Anthony Green wrote:
 I've committed this patch.
 
 Thanks,
 
 Anthony Green

Anthony,
Did you run make check in libffi on this merge? These changes
appear to have broken the dejagnu testing in libffi...

# make -k check
Password:
Making check in include
make[1]: Nothing to be done for `check'.
Making check in testsuite
make  check-DEJAGNU
srcdir='../../../../gcc-4.8-20121226/libffi/testsuite'; export srcdir; \
EXPECT=`if [ -f ../../expect/expect ] ; then echo ../../expect/expect ; 
else echo expect ; fi`; export EXPECT; \
runtest=`if [ -f ../../../../gcc-4.8-20121226/libffi/../dejagnu/runtest 
] ; then echo ../../../../gcc-4.8-20121226/libffi/../dejagnu/runtest ; else 
echo runtest; fi`; \
if /bin/sh -c $runtest --version  /dev/null 21; then \
  exit_status=0; l='libffi'; for tool in $l; do \
if $runtest  --tool $tool --srcdir $srcdir ; \
then :; else exit_status=1; fi; \
  done; \
else echo WARNING: could not find \`runtest' 12; :;\
fi; \
exit $exit_status
WARNING: Couldn't find the global config file.
Test Run By root on Thu Dec 27 09:48:42 2012
Native configuration is x86_64-apple-darwin12.2.0

=== libffi tests ===

Schedule of variations:
unix

Running target unix
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for 
target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using ../../../../gcc-4.8-20121226/libffi/testsuite/config/default.exp as 
tool-and-target-specific interface file.
Running ../../../../gcc-4.8-20121226/libffi/testsuite/libffi.call/call.exp ...
ERROR: (DejaGnu) proc set_ld_library_path_env_vars does not exist.
The error code is NONE
The info on the error is:
invalid command name set_ld_library_path_env_vars
while executing
::tcl_unknown set_ld_library_path_env_vars
(uplevel body line 1)
invoked from within
uplevel 1 ::tcl_unknown $args

=== libffi Summary ===

make[2]: *** [check-DEJAGNU] Error 1
make[1]: *** [check-am] Error 2
make[1]: Target `check' not remade because of errors.


This is showing up repeatedly in gcc-regressions.
  Jack

 
 
 On Sun, Dec 23, 2012 at 4:37 PM, Anthony Green gr...@moxielogic.com wrote:
  The attached patch is fairly complete merge of the libffi side-stream
  git repo.  Highlights include aarch64 support, blackfin support, and
  additional windows ABI support.   I will commit this in a day or two
  unless there are any objections.
 
  Thanks,
 
  Anthony Green
 
 
  2012-10-30  Magnus Granberg  zo...@gentoo.org
Pavel Labushev  pavel.labus...@runbox.ru
 
  * configure.ac: New options pax_emutramp
  * configure, fficonfig.h.in: Regenerated
  * src/closures.c: New function emutramp_enabled_check() and
  checks.
 
  2012-10-30  Frederick Cheung  frederick.che...@gmail.com
 
  * configure.ac: Enable FFI_MAP_EXEC_WRIT for Darwin 12 (mountain
  lion) and future version.
  * configure: Rebuild.
 
  2012-10-30  James Greenhalgh  james.greenhalgh at arm.com
Marcus Shawcroft  marcus.shawcroft at arm.com
 
  * README: Add details of aarch64 port.
  * src/aarch64/ffi.c: New.
  * src/aarch64/ffitarget.h: Likewise.
  * src/aarch64/sysv.S: Likewise.
  * Makefile.am: Support aarch64.
  * configure.ac: Support aarch64.
  * Makefile.in, configure: Rebuilt.
 
  2012-10-30  James Greenhalgh  james.greenhalgh at arm.com
Marcus Shawcroft  marcus.shawcroft at arm.com
 
  * testsuite/lib/libffi.exp: Add support for aarch64.
  * testsuite/libffi.call/cls_struct_va1.c: New.
  * testsuite/libffi.call/cls_uchar_va.c: Likewise.
  * testsuite/libffi.call/cls_uint_va.c: Likewise.
  * testsuite/libffi.call/cls_ulong_va.c: Likewise.
  * testsuite/libffi.call/cls_ushort_va.c: Likewise.
  * testsuite/libffi.call/nested_struct11.c: Likewise.
  * testsuite/libffi.call/uninitialized.c: Likewise.
  * testsuite/libffi.call/va_1.c: Likewise.
  * testsuite/libffi.call/va_struct1.c: Likewise.
  * testsuite/libffi.call/va_struct2.c: Likewise.
  * testsuite/libffi.call/va_struct3.c: Likewise.
 
  2012-10-12  Walter Lee  w...@tilera.com
 
  * Makefile.am: Add TILE-Gx/TILEPro support.
  * configure.ac: Likewise.
  * Makefile.in: Regenerate.
  * configure: Likewise.
  * src/prep_cif.c (ffi_prep_cif_core): Handle TILE-Gx/TILEPro.
  * src/tile: New directory.
  * src/tile/ffi.c: New file.
  * src/tile/ffitarget.h: Ditto.
  * src/tile/tile.S: Ditto.
 
  2012-10-12  Matthias Klose  d...@ubuntu.com
 
  * generate-osx-source-and-headers.py: Normalize whitespace.
 
  2012-05-05  Nicolas Lelong
 
  * 

Re: [Patch, libffi] libffi merge

2012-12-27 Thread Andreas Schwab
Jack Howarth howa...@bromo.med.uc.edu writes:

 Did you run make check in libffi on this merge? These changes
 appear to have broken the dejagnu testing in libffi...

The problem is the wrong definition of load_gcc_lib.

@@ -16,7 +16,7 @@
 
 proc load_gcc_lib { filename } {
 global srcdir
-load_file $srcdir/../../gcc/testsuite/lib/$filename
+load_file $srcdir/lib/$filename
 }
 
 load_lib dg.exp

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.


Re: [Patch, libffi] libffi merge

2012-12-27 Thread Jack Howarth
On Thu, Dec 27, 2012 at 04:06:47PM +0100, Andreas Schwab wrote:
 Jack Howarth howa...@bromo.med.uc.edu writes:
 
  Did you run make check in libffi on this merge? These changes
  appear to have broken the dejagnu testing in libffi...
 
 The problem is the wrong definition of load_gcc_lib.
 
 @@ -16,7 +16,7 @@
  
  proc load_gcc_lib { filename } {
  global srcdir
 -load_file $srcdir/../../gcc/testsuite/lib/$filename
 +load_file $srcdir/lib/$filename
  }
  
  load_lib dg.exp
 
 Andreas.

Andreas,
   What do you get for the testsuite results with that change? On
x86_64-apple-darwin12, every single test seems to fail the
test for excess errors at -m32 (but not -m64) when using...

make -k check RUNTESTFLAGS=--target_board=unix'{-m32,-m64}'

=== libffi Summary for unix/-m32 ===

# of unexpected failures663
# of unresolved testcases   663
# of unsupported tests  55

These show up at -m32 as...

Executing on host: /sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/xgcc 
-B/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/ 
../../../../gcc-4.8-20121226/libffi/testsuite/libffi.call/closure_fn0.c  -O0 -W 
-Wall  
-I/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin12.2.0/libffi/testsuite/../include
 -I../../../../gcc-4.8-20121226/libffi/testsuite/../include  
-I/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin12.2.0/libffi/testsuite/../include/..
 
-L/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin12.2.0/libffi/testsuite/../.libs
 -Wl,-allow_stack_execute  -shared-libgcc -lffi -lm   -m32 -o ./closure_fn0.exe 
   (timeout = 300)
ld: warning: ignoring file 
/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin12.2.0/libffi/.libs/libffi.dylib,
 file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 
0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture 
being linked (i386): 
/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin12.2.0/libffi/.libs/libffi.dylib^M
Undefined symbols for architecture i386:^M
  _ffi_closure_alloc, referenced from:^M
  _main in ccIwL8dt.o^M
  _ffi_prep_cif, referenced from:^M
  _main in ccIwL8dt.o^M
  _ffi_prep_closure_loc, referenced from:^M
  _main in ccIwL8dt.o^M
  _ffi_type_double, referenced from:^M
  _main in ccIwL8dt.o^M
  _ffi_type_float, referenced from:^M
  _main in ccIwL8dt.o^M
  _ffi_type_sint16, referenced from:^M
  _main in ccIwL8dt.o^M
  _ffi_type_sint32, referenced from:^M
  _main in ccIwL8dt.o^M
  _ffi_type_uint64, referenced from:^M
  _main in ccIwL8dt.o^M
ld: symbol(s) not found for architecture i386^M
collect2: error: ld returned 1 exit status^M

So it appears that the merge also broke the multilib testing of libffi.
   Jack


 
 -- 
 Andreas Schwab, sch...@linux-m68k.org
 GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
 And now for something completely different.


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-27 Thread Richard Biener
On Sat, Dec 22, 2012 at 12:03 PM, Andreas Schwab sch...@linux-m68k.org wrote:
 Richard Biener richard.guent...@gmail.com writes:

 On Sat, Dec 22, 2012 at 10:49 AM, Andreas Schwab sch...@linux-m68k.org 
 wrote:
 Richard Biener rguent...@suse.de writes:

 (I suppose somehow gmp.h is pulled in configure tests?)

 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include ansidecl.h
 #include system.h
 #ifdef HAVE_SYS_RESOURCE_H
 #include sys/resource.h
 #endif
 ]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long],
 [Define to `long' if sys/resource.h doesn't define.])])

 Huh - looks at least bogus to not include config.h here, no?

 config.h uses auto-host.h which doesn't exist yet, it's created by
 configure.  All already known config defs are set in conftest.c (see
 config.log).

I still question the inclusion of system.h here - why is that needed, or
why isn't this either a copy of the relevant piece of system.h, or - _just_
including system.h and nothing else ... in fact system.h already includes
sys/resource.h the way above.

Richard.

 Andreas.

 --
 Andreas Schwab, sch...@linux-m68k.org
 GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
 And now for something completely different.


Re: [Patch, libffi] libffi merge

2012-12-27 Thread Jack Howarth
On Thu, Dec 27, 2012 at 10:19:57AM -0500, Jack Howarth wrote:
 On Thu, Dec 27, 2012 at 04:06:47PM +0100, Andreas Schwab wrote:
  Jack Howarth howa...@bromo.med.uc.edu writes:
  
   Did you run make check in libffi on this merge? These changes
   appear to have broken the dejagnu testing in libffi...
  
  The problem is the wrong definition of load_gcc_lib.
  
  @@ -16,7 +16,7 @@
   
   proc load_gcc_lib { filename } {
   global srcdir
  -load_file $srcdir/../../gcc/testsuite/lib/$filename
  +load_file $srcdir/lib/$filename
   }
   
   load_lib dg.exp
  
  Andreas.
 
 Andreas,
What do you get for the testsuite results with that change? On
 x86_64-apple-darwin12, every single test seems to fail the
 test for excess errors at -m32 (but not -m64) when using...
 
 make -k check RUNTESTFLAGS=--target_board=unix'{-m32,-m64}'
 
 === libffi Summary for unix/-m32 ===
 
 # of unexpected failures663
 # of unresolved testcases   663
 # of unsupported tests  55
 
 These show up at -m32 as...
 
 Executing on host: /sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/xgcc 
 -B/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/ 
 ../../../../gcc-4.8-20121226/libffi/testsuite/libffi.call/closure_fn0.c  -O0 
 -W -Wall  
 -I/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin12.2.0/libffi/testsuite/../include
  -I../../../../gcc-4.8-20121226/libffi/testsuite/../include  
 -I/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin12.2.0/libffi/testsuite/../include/..
  
 -L/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin12.2.0/libffi/testsuite/../.libs
  -Wl,-allow_stack_execute  -shared-libgcc -lffi -lm   -m32 -o 
 ./closure_fn0.exe(timeout = 300)
 ld: warning: ignoring file 
 /sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin12.2.0/libffi/.libs/libffi.dylib,
  file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 
 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the 
 architecture being linked (i386): 
 /sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin12.2.0/libffi/.libs/libffi.dylib^M
 Undefined symbols for architecture i386:^M
   _ffi_closure_alloc, referenced from:^M
   _main in ccIwL8dt.o^M
   _ffi_prep_cif, referenced from:^M
   _main in ccIwL8dt.o^M
   _ffi_prep_closure_loc, referenced from:^M
   _main in ccIwL8dt.o^M
   _ffi_type_double, referenced from:^M
   _main in ccIwL8dt.o^M
   _ffi_type_float, referenced from:^M
   _main in ccIwL8dt.o^M
   _ffi_type_sint16, referenced from:^M
   _main in ccIwL8dt.o^M
   _ffi_type_sint32, referenced from:^M
   _main in ccIwL8dt.o^M
   _ffi_type_uint64, referenced from:^M
   _main in ccIwL8dt.o^M
 ld: symbol(s) not found for architecture i386^M
 collect2: error: ld returned 1 exit status^M
 
 So it appears that the merge also broke the multilib testing of libffi.
Jack
 
 

The m4's included in the Makefile.am of the libffi testsuite is wildly different
(and misses multi.m4 completely)

@@ -37,22 +54,32 @@
 subdir = testsuite
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
-   $(top_srcdir)/../config/lead-dot.m4 \
-   $(top_srcdir)/../config/multi.m4 \
-   $(top_srcdir)/../config/override.m4 \
-   $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
-   $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
-   $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \
+   $(top_srcdir)/m4/ax_cc_maxopt.m4 \
+   $(top_srcdir)/m4/ax_cflags_warn_all.m4 \
+   $(top_srcdir)/m4/ax_check_compile_flag.m4 \
+   $(top_srcdir)/m4/ax_compiler_vendor.m4 \
+   $(top_srcdir)/m4/ax_configure_args.m4 \
+   $(top_srcdir)/m4/ax_enable_builddir.m4 \
+   $(top_srcdir)/m4/ax_gcc_archflag.m4 \
+   $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \
+   $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+   $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+   $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/fficonfig.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 SOURCES =
 DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+n|no|NO) false;; \
+*) (install-info --version) /dev/null 21;; \
+  esac
 DEJATOOL = $(PACKAGE)
 RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)

  
  -- 
  Andreas Schwab, sch...@linux-m68k.org
  GPG Key fingerprint = 

Re: [patch, fortran] PR48976 INQUIRE with STREAM= not supported

2012-12-27 Thread Jerry DeLisle

On 12/27/2012 03:12 AM, Tobias Burnus wrote:

Dear Jerry,

thanks for the patch.However, I wonder about the following:

Will that be backward compatible with binaries compiled with GCC  4.8 or will
that cause problems? I have the feeling that it is okay as the flag (cf2)
indicating whether stream= is present has still the same type and iqstream
comes last in st_parameter_inquire and is only set if (cf2 
IOPARM_INQUIRE_HAS_STREAM).

Can confirm that there is no backward-compatibility issue? If there isn't, the
patch is okay.

Tobias


The cf2 flag exists and we are using the next unused bit as defined in 
ioparm.def. No previous version of the frontend or the runtime library use or 
look at this bit so there will be no compatibility issues.


I named the stream pointer iqstream to avoid it being color highlighted. My 
editor highlights stream has a C key word.


I will change the constant parameter IOPARM_INQUIRE_HAS_STREAM to 
IOPARM_INQUIRE_HAS_IQSTREAM just for consistency so that in the future, 
maintainers will know it is related to the use of the iqstream pointer.


I will commit the patch later today and thanks for the review.

Regards,

Jerry


[PATCH] AIX native TLS support [3/?]

2012-12-27 Thread David Edelsohn
This patch gets GCC support for native TLS on AIX working and passing
most tests.

The patch shifts the creation of the qualified symbol name from
output_toc() to rs6000_legitimize_tls_address_aix(). I was hoping that
the separate SYMBOL_REF would prevent RTL fwprop from becoming
confused about the symbols, but no such luck. The re-write still makes
things a little cleaner.

Also, private TLS data (static variables with non-zero initializers)
are not decorated with the TLS CSECT qualifier so that the AIX
assembler and linker resolve it correctly.

To prevent fwprop from breaking things, I need to prevent
rs6000_delegitimize_address from associating TLS TOC references with
the original symbol. The rs6000 port uses the constant pool to manage
the TOC.  However, for TLS symbols, the value in the TOC is not
equivalent to the symbol itself. The RTL fwprop pass thinks that it
can associate the result of a TLS access, which materializes the
symbol in a register, with the value in the constant pool and avoid
re-loading the TOC value. This does not work and passes a garbage
value to subsequent TLS calls, which produce garbage results. The two
solutions are either hide the TLS constant pool values by not
delegitmizing them or completely re-writing the TOC support to use a
pool separate from the constant pool.  I chose the former because TLS
is a scarce resource and its usage should be minimal anyway.

Bootstrapped on powerpc-ibm-aix7.1.0.0.

Thanks, David

* config/rs6000/rs6000.c (rs6000_deligitimze_address): Do not
delegitimize TLS addresses on AIX.
(rs6000_legitimize_tls_address_aix): Append TLS symbol qualifier.
Set SYMBOL_FLAG_LOCAL on module symbol.
(output_toc): Do not append TLS symbol qualifier here.
* config/rs6000/rs6000.md (tls_get_addr_internal): Add GPR 4 to
clobbers.

Index: rs6000.c
===
--- rs6000.c(revision 194725)
+++ rs6000.c(working copy)
@@ -5826,6 +5826,15 @@ rs6000_delegitimize_address (rtx orig_x)
}
 #endif
   y = XVECEXP (y, 0, 0);
+
+#ifdef HAVE_AS_TLS
+  /* Do not associate thread-local symbols with the original
+constant pool symbol.  */
+  if (TARGET_XCOFF
+  SYMBOL_REF_TLS_MODEL (get_pool_constant (y)) = TLS_MODEL_REAL)
+   return orig_x;
+#endif
+
   if (offset != NULL_RTX)
y = gen_rtx_PLUS (Pmode, y, offset);
   if (!MEM_P (orig_x))
@@ -5899,10 +5908,29 @@ rs6000_got_sym (void)
 static rtx
 rs6000_legitimize_tls_address_aix (rtx addr, enum tls_model model)
 {
-  rtx sym, mem, tocref, tlsreg, tmpreg, dest;
+  rtx sym, mem, tocref, tlsreg, tmpreg, dest, tlsaddr;
+  const char *name;
+  char *tlsname;

+  name = XSTR (addr, 0);
+  /* Append TLS CSECT qualifier, unless the symbol already is qualified
+ or the symbol will be in TLS private data section.  */
+  if (name[strlen (name) - 1] != ']'
+   (TREE_PUBLIC (SYMBOL_REF_DECL (addr))
+ || bss_initializer_p (SYMBOL_REF_DECL (addr
+{
+  tlsname = XALLOCAVEC (char, strlen (name) + 4);
+  strcpy (tlsname, name);
+  strcat (tlsname,
+ bss_initializer_p (SYMBOL_REF_DECL (addr)) ? [UL] : [TL]);
+  tlsaddr = copy_rtx (addr);
+  XSTR (tlsaddr, 0) = ggc_strdup (tlsname);
+}
+  else
+tlsaddr = addr;
+
   /* Place addr into TOC constant pool.  */
-  sym = force_const_mem (GET_MODE (addr), addr);
+  sym = force_const_mem (GET_MODE (tlsaddr), tlsaddr);

   /* Output the TOC entry and create the MEM referencing the value.  */
   if (constant_pool_expr_p (XEXP (sym, 0))
@@ -5919,27 +5947,28 @@ rs6000_legitimize_tls_address_aix (rtx addr, enum
   if (model == TLS_MODEL_GLOBAL_DYNAMIC
   || model == TLS_MODEL_LOCAL_DYNAMIC)
 {
-  rtx module = gen_reg_rtx (Pmode);
   /* Create new TOC reference for @m symbol.  */
-  const char *name = XSTR (XVECEXP (XEXP (mem, 0), 0, 0), 0);
-  char *name2 = XALLOCAVEC (char, strlen (name) + 1);
-  strcpy (name2, *LCM);
-  strcat (name2, name + 3);
-  tocref = create_TOC_reference (gen_rtx_SYMBOL_REF (Pmode,
-
ggc_alloc_string (name2,
-
strlen (name2))),
-NULL_RTX);
-  rtx mem2 = gen_const_mem (Pmode, tocref);
-  set_mem_alias_set (mem2, get_TOC_alias_set ());
+  name = XSTR (XVECEXP (XEXP (mem, 0), 0, 0), 0);
+  tlsname = XALLOCAVEC (char, strlen (name) + 1);
+  strcpy (tlsname, *LCM);
+  strcat (tlsname, name + 3);
+  rtx modaddr = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tlsname));
+  SYMBOL_REF_FLAGS (modaddr) |= SYMBOL_FLAG_LOCAL;
+  tocref = create_TOC_reference (modaddr, NULL_RTX);
+  rtx modmem = gen_const_mem (Pmode, tocref);
+  set_mem_alias_set (modmem, get_TOC_alias_set ());

-  dest = gen_reg_rtx (Pmode);
+  rtx modreg = gen_reg_rtx (Pmode);
+  emit_insn (gen_rtx_SET (VOIDmode, modreg, modmem));
+
   tmpreg = gen_reg_rtx (Pmode);
 

Re: [patch c++]: Fix type_info struct for llp64 targets

2012-12-27 Thread Jason Merrill

OK.

Jason


Re: [PATCH] Function Multiversioning Bug, checking for function versions

2012-12-27 Thread Sriraman Tallam
On Thu, Dec 27, 2012 at 2:05 AM, Andreas Schwab sch...@linux-m68k.org wrote:
 diff --git a/gcc/ChangeLog b/gcc/ChangeLog
 index 148388d..575e03a 100644
 --- a/gcc/ChangeLog
 +++ b/gcc/ChangeLog
 @@ -1,4 +1,7 @@
 - .mine
 +2012-12-27  Andreas Schwab  sch...@linux-m68k.org
 +
 +   * target.def (supports_function_versions): Fix typo.
 +

  2012-12-26  Sriraman Tallam  tmsri...@google.com

 * doc/tm.texi.in (TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS): Document
 @@ -15,12 +18,10 @@
 * (is_function_default_version): Check target string.
 * TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS: New macro.

 -===
  2012-12-27  Steven Bosscher  ste...@gcc.gnu.org

 * cgraph.c (verify_cgraph_node): Don't allocate/free visited_nodes 
 set.

 - .r194729
  2012-12-25  John David Anglin  dave.ang...@nrc-cnrc.gc.ca

 PR target/53789
 diff --git a/gcc/target.def b/gcc/target.def
 index 79bb955..d0547be 100644
 --- a/gcc/target.def
 +++ b/gcc/target.def
 @@ -2839,7 +2839,7 @@ DEFHOOK
  (supports_function_versions,
   ,
   bool, (void),
 - hool_bool_void_false)
 + hook_bool_void_false)

Thanks for the fix.

-Sri.


  /* Function to determine if one function can inline another function.  */
  #undef HOOK_PREFIX
 --
 1.8.0.2


 --
 Andreas Schwab, sch...@linux-m68k.org
 GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
 And now for something completely different.


Re: [Patch, Fortran] PR55763 - Fix MOVE_ALLOC with CLASS(*)

2012-12-27 Thread Tobias Burnus

*ping*

http://gcc.gnu.org/ml/fortran/2012-12/msg00167.html

Tobias Burnus:
Fix one of the remaining issues of PR 55763: MOVE_ALLOC with CLASS(*) 
either for both arguments or only for TO=.


Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias




[Patch, Fortran] PR55758 - Non-C_Bool handling with BIND(C)

2012-12-27 Thread Tobias Burnus

Dear all,

See also the discussion in the thread starting at 
http://gcc.gnu.org/ml/fortran/2012-12/msg00135.html


a) The Fortran standard only defines LOGICAL(kind=C_Bool) as being 
interoperable with C - no other LOGICAL type. That matches GCC: With gcc 
(the C compiler) only _Bool is a BOOLEAN_TYPE with TYPE_PRECISION == 1. 
Hence, this patch rejects other logical kinds as dummy argument/result 
variable in BIND(C) procedures if -std=f2003/f2008/f2008ts is specified 
(using -pedantic, one gets a warning).


b) As GNU extension, other logical kinds are accepted in BIND(C) 
procedures; however, as the main use of LOGICAL(kind=4) (for BIND(C) 
procedures) is to handle logical expressions which use C's int, one has 
to deal with all integer values and not only 0 and 1. Hence, a normal 
integer type is used internally in that case. That has been done to 
avoid surprises of users and hard to trace bugs.


Note: logical(c_bool) and all logicals which are not dummy or result 
variables of a bind(C) procedure remain BOOLEAN_TYPEs  with 
TYPE_PRECISION == 1 bit. For those a .true. with internal value -1 
will lead the surprising result .not.(-1) = (-2) = .true., i.e. .true. 
== .not. .true. But that's simply an invaliduse of those logicals and 
not a bug in the compiler. (- won't fix).



Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias
2012-12-27  Tobias Burnus  bur...@net-b.de

	PR fortran/55758
	* resolve.c (resolve_symbol): Reject non-C_Bool logicals
	in BIND(C) procedures with -std=f*.
	* trans-types.c (gfc_sym_type): Use a non-BOOLEAN_TYPE
	integer for non-C_Bool logicals in BIND(C) procedures.
	* trans-expr.c (gfc_conv_unary_op): Add fold convert for
	INTRINSIC_NOT.

2012-12-27  Tobias Burnus  bur...@net-b.de

	PR fortran/55758
	* gfortran.dg/bind_c_bool_1.f90: New.
	* gfortran.dg/bind_c_bool_2.f90: New.
	* gfortran.dg/bind_c_bool_2_c.c: New.
	* gfortran.dg/do_5.f90: Add dg-warning.

diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 873400a..5963acd 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -13640,6 +13636,32 @@ resolve_symbol (gfc_symbol *sym)
   return;
 }
 
+  if (sym-ts.type == BT_LOGICAL
+   ((sym-attr.function  sym-attr.is_bind_c  sym-result == sym)
+	  || ((sym-attr.dummy || sym-attr.result)  sym-ns-proc_name
+	   sym-ns-proc_name-attr.is_bind_c)))
+{
+  int i;
+  for (i = 0; gfc_logical_kinds[i].kind; i++)
+if (gfc_logical_kinds[i].kind == sym-ts.kind)
+  break;
+  if (!gfc_logical_kinds[i].c_bool  sym-attr.dummy
+	   gfc_notify_std (GFC_STD_GNU, LOGICAL dummy argument '%s' at %L 
+			 with non-C_Bool kind in BIND(C) procedure '%s',
+			 sym-name, sym-declared_at,
+			 sym-ns-proc_name-name) == FAILURE)
+	return;
+  else if (!gfc_logical_kinds[i].c_bool
+	gfc_notify_std (GFC_STD_GNU, LOGICAL result variable '%s' at
+   %L with non-C_Bool kind in BIND(C) 
+  procedure '%s', sym-name,
+  sym-declared_at,
+  sym-attr.function ? sym-name
+		 : sym-ns-proc_name-name)
+		  == FAILURE)
+	return;
+}
+
   switch (sym-attr.flavor)
 {
 case FL_VARIABLE:
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 452f2bc..bbfb162 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -1850,7 +1850,8 @@ gfc_conv_unary_op (enum tree_code code, gfc_se * se, gfc_expr * expr)
  We must convert it to a compare to 0 (e.g. EQ_EXPR (op1, 0)).
  All other unary operators have an equivalent GIMPLE unary operator.  */
   if (code == TRUTH_NOT_EXPR)
-se-expr = fold_build2_loc (input_location, EQ_EXPR, type, operand.expr,
+se-expr = fold_build2_loc (input_location, EQ_EXPR, type,
+fold_convert (type, operand.expr),
 build_int_cst (type, 0));
   else
 se-expr = fold_build1_loc (input_location, code, type, operand.expr);
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 8394bf9..73ed5aa 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -2128,6 +2128,25 @@ gfc_sym_type (gfc_symbol * sym)
 	   sym-ns-proc_name
 	   sym-ns-proc_name-attr.is_bind_c)))
 type = gfc_character1_type_node;
+  else if (sym-ts.type == BT_LOGICAL
+	((sym-attr.function  sym-attr.is_bind_c)
+	   || ((sym-attr.dummy || sym-attr.result)  sym-ns-proc_name
+		sym-ns-proc_name-attr.is_bind_c)))
+{
+  /* For LOGICAL dummy arguments or result value of a C binding procedure,
+ which do not match _Bool (C_Bool kind), a normal integer variable
+ is used instead of a BOOLEAN_TYPE with a TYPE_PRECISION of 1. The
+	 reason is that on the C side, a normal integer such as int is used,
+	 implying that any integer value could be used - not only 0 and 1.  */
+  int i;
+  for (i = 0; gfc_logical_kinds[i].kind; i++)
+if (gfc_logical_kinds[i].kind == sym-ts.kind)
+  break;
+  if (!gfc_logical_kinds[i].c_bool)
+	type = gfc_get_int_type 

Re: [RFC PATCH] Implementing ifunc target hook

2012-12-27 Thread Maxim Kuvyrkov
On 27/12/2012, at 1:15 AM, Alexander Ivchenko wrote:

 Hi,
 
 Currently Android dynamic loader does not support indirect functions
 (And I don't think that
 it will someday). But there is no way for us to specify that for gcc,
 and for example, tests like
 gcc.dg/attr-ifunc-* are failing on android right now.
 The attached patch is indended to add the target hook for indicating
 the support of ifunc on target.

The idea behind the patch looks OK, but implementation needs a bit of tweaking.

As Joseph mentioned, you need to convert this macro into a target hook.  GCC is 
making a gradual transition away from target macros to target hook functions, 
and all new hooks should be added as functions, unless there is a compelling 
argument to make it a macro.  For an example of adding a target hook function 
see rev 194608 (among many others).

 --- a/gcc/config/i386/i386.c
 +++ b/gcc/config/i386/i386.c
 @@ -29146,7 +29146,7 @@ make_name (tree decl, const char *suffix, bool 
 make_unique)
return global_var_name;
  }
  
 -#if defined (ASM_OUTPUT_TYPE_DIRECTIVE)  HAVE_GNU_INDIRECT_FUNCTION
 +#if defined (ASM_OUTPUT_TYPE_DIRECTIVE)
  
  /* Make a dispatcher declaration for the multi-versioned function DECL.
 Calls to DECL function will be replaced with calls to the dispatcher
 @@ -29213,7 +29213,7 @@ ix86_get_function_versions_dispatcher (void *decl)
  
tree dispatch_decl = NULL;
  
 -#if defined (ASM_OUTPUT_TYPE_DIRECTIVE)  HAVE_GNU_INDIRECT_FUNCTION
 +#if defined (ASM_OUTPUT_TYPE_DIRECTIVE)
struct cgraph_function_version_info *it_v = NULL;
struct cgraph_node *dispatcher_node = NULL;
struct cgraph_function_version_info *dispatcher_version_info = NULL;

It seems you can move these variables inside the 'if (TARGET_HAS_IFUNC)' clause 
below and make the code cleaner, no?

 @@ -29263,24 +29263,33 @@ ix86_get_function_versions_dispatcher (void *decl)
  
default_node = default_version_info-this_node;
  
 -#if defined (ASM_OUTPUT_TYPE_DIRECTIVE)  HAVE_GNU_INDIRECT_FUNCTION
 -  /* Right now, the dispatching is done via ifunc.  */
 -  dispatch_decl = make_dispatcher_decl (default_node-symbol.decl);
 -
 -  dispatcher_node = cgraph_get_create_node (dispatch_decl);
 -  gcc_assert (dispatcher_node != NULL);
 -  dispatcher_node-dispatcher_function = 1;
 -  dispatcher_version_info
 -= insert_new_cgraph_node_version (dispatcher_node);
 -  dispatcher_version_info-next = default_version_info;
 -  dispatcher_node-local.finalized = 1;
 -
 -  /* Set the dispatcher for all the versions.  */
 -  it_v = default_version_info;
 -  while (it_v-next != NULL)
 +#if defined (ASM_OUTPUT_TYPE_DIRECTIVE)
 +  if (TARGET_HAS_IFUNC)
 +{
 +  /* Right now, the dispatching is done via ifunc.  */
 +  dispatch_decl = make_dispatcher_decl (default_node-symbol.decl);
 +
 +  dispatcher_node = cgraph_get_create_node (dispatch_decl);
 +  gcc_assert (dispatcher_node != NULL);
 +  dispatcher_node-dispatcher_function = 1;
 +  dispatcher_version_info
 + = insert_new_cgraph_node_version (dispatcher_node);
 +  dispatcher_version_info-next = default_version_info;
 +  dispatcher_node-local.finalized = 1;
 +
 +  /* Set the dispatcher for all the versions.  */
 +  it_v = default_version_info;
 +  while (it_v-next != NULL)
 + {
 +   it_v-dispatcher_resolver = dispatch_decl;
 +   it_v = it_v-next;
 + }
 +}
 +  else
  {
 -  it_v-dispatcher_resolver = dispatch_decl;
 -  it_v = it_v-next;
 +  error_at (DECL_SOURCE_LOCATION (default_node-symbol.decl),
 + multiversioning needs ifunc which is not supported 
 + on this target);
  }

This looks wrong.  Before the patch this code would be ignored if 
!HAVE_GNU_INDIRECT_FUNCTION and after the patch it will produce an error.  
Removing the else-clause should fix this.

  #else
error_at (DECL_SOURCE_LOCATION (default_node-symbol.decl),
 diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
 index e74e261..f6f44f1 100644
 --- a/gcc/config/linux-android.h
 +++ b/gcc/config/linux-android.h
 @@ -58,3 +58,6 @@
  
  #define ANDROID_ENDFILE_SPEC \
%{shared: crtend_so%O%s;: crtend_android%O%s}
 +
 +#undef TARGET_HAS_IFUNC
 +#define TARGET_HAS_IFUNC (!TARGET_ANDROID)

This initialization should be moved to targethooks.c ...

 diff --git a/gcc/defaults.h b/gcc/defaults.h
 index 76909ab..2180a47 100644
 --- a/gcc/defaults.h
 +++ b/gcc/defaults.h
 @@ -111,6 +111,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
  If not, see
  #endif
  #endif
  
 +#ifndef TARGET_HAS_IFUNC
 +#define TARGET_HAS_IFUNC HAVE_GNU_INDIRECT_FUNCTION
 +#endif

... and this one too.

 +
  #ifndef IFUNC_ASM_TYPE
  #define IFUNC_ASM_TYPE gnu_indirect_function
  #endif
 diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
 index 75aa867..1c8bc51 100644
 --- a/gcc/doc/tm.texi
 +++ b/gcc/doc/tm.texi
 @@ -5847,6 +5847,12 @@ If @code{ASM_OUTPUT_DEF} is not available, the hook's 
 default definition
  

Re: [patch] std::unique_ptrT[], D improvements

2012-12-27 Thread Lawrence Crowl
On 12/20/12, Jonathan Wakely jwakely@gmail.com wrote:
 This patch started when I noticed that it's not possibly to construct
 a shared_ptrT from unique_ptrT[], D, then I discovered we don't
 use D::pointer if it exists, and there were a number of other
 non-conformance issues with our std::unique_ptrT[], D.  I ended up
 fixing them by implementing Geoffrey's proposed resolution for LWG
 issue 2118, which isn't official yet but is better than what we had
 before so is a step in the right direction, even if it ends up needing
 further revision when 2118 is resolved.

 * include/std/functional (_Require): Move to ...
 * include/std/type_traits (_Require): ... here.
 * include/bits/shared_ptr_base.h
 (__shared_count::_S_create_from_up):
 Handle unique_ptr for arrays or with custom pointer types.
 (__shared_ptr::__shared_ptr(unique_ptr_Tp1, _Del): Likewise.
 * include/bits/unique_ptr.h (unique_ptr_Tp[], _Dp): Use
 _Dp::pointer if defined. Implement proposed resolution of LWG 2118.
 * testsuite/20_util/shared_ptr/cons/unique_ptr_array.cc: New.
 * testsuite/20_util/unique_ptr/assign/cv_qual.cc: New.
 * testsuite/20_util/unique_ptr/cons/array_convertible_neg.cc: New.
 * testsuite/20_util/unique_ptr/cons/convertible_neg.cc: New.
 * testsuite/20_util/unique_ptr/cons/cv_qual.cc: New.
 * testsuite/20_util/unique_ptr/modifiers/cv_qual.cc: New.
 * testsuite/20_util/unique_ptr/requirements/pointer_type_array.cc:
 New.
 * testsuite/20_util/shared_ptr/cons/unique_ptr.cc: Adjust comments.
 *
 testsuite/20_util/unique_ptr/cons/pointer_array_convertible_neg.cc:
 Likewise.
 * testsuite/20_util/unique_ptr/requirements/pointer_type.cc:
 Likewise.
 * testsuite/20_util/bind/ref_neg.cc: Adjust dg-error line number.
 * testsuite/20_util/declval/requirements/1_neg.cc: Likewise.
 * testsuite/20_util/default_delete/48631_neg.cc: Likewise.
 * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Likewise.
 * testsuite/20_util/unique_ptr/assign/48635_neg.cc: Likewise.
 * testsuite/20_util/unique_ptr/modifiers/reset_neg.cc: Adjust
 dg-error text.
 * testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc: Use
 different instantiations so static_assert fails for each.

 Thanks to Geoffrey and Lawrence for input and test cases.

 Tested x86_64-linux, committed to trunk.

I'm not getting errors when converting from derived to base.
E.g. the following compiles, when it should not.

std::unique_ptrconst base [] acb_ad(new derived[3]);

-- 
Lawrence Crowl


[patch, libgfortran] PR55818 Reading a REAL from a file which doesn't end in a new line fails

2012-12-27 Thread Jerry DeLisle

Hi,

The attached patch fixes this problem by not calling hit_eof if EOF can be a
valid separator.

Regression tested on x86-64.

OK for trunk with test case from PR?

Regards,

Jerry

2012-12-27  Jerry DeLisle  jvdeli...@gcc.gnu.org

PR libfortran/55818
* io/list_read.c (read_real): Do not call hit_eof when EOF can be
treated as a value separator



Index: list_read.c
===
--- list_read.c	(revision 194731)
+++ list_read.c	(working copy)
@@ -1429,6 +1429,7 @@ read_real (st_parameter_dt *dtp, void * dest, int
   goto got_sign;
 
 CASE_SEPARATORS:
+case EOF:
   unget_char (dtp, c);		/* Single null.  */
   eat_separator (dtp);
   return;
@@ -1484,6 +1485,7 @@ read_real (st_parameter_dt *dtp, void * dest, int
 	  goto got_repeat;
 
 	CASE_SEPARATORS:
+	case EOF:
   if (c != '\n'  c != ','  c != '\r'  c != ';')
 	unget_char (dtp, c);
 	  goto done;



Re: [PATCH] Function Multiversioning Bug, checking for function versions

2012-12-27 Thread Alexander Ivchenko
I'm sorry - I didn't notice that it works only for c++ frontend. It
works for me now!

thanks,
Alexander

2012/12/27 Sriraman Tallam tmsri...@google.com:
 On Thu, Dec 27, 2012 at 2:05 AM, Andreas Schwab sch...@linux-m68k.org wrote:
 diff --git a/gcc/ChangeLog b/gcc/ChangeLog
 index 148388d..575e03a 100644
 --- a/gcc/ChangeLog
 +++ b/gcc/ChangeLog
 @@ -1,4 +1,7 @@
 - .mine
 +2012-12-27  Andreas Schwab  sch...@linux-m68k.org
 +
 +   * target.def (supports_function_versions): Fix typo.
 +

  2012-12-26  Sriraman Tallam  tmsri...@google.com

 * doc/tm.texi.in (TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS): Document
 @@ -15,12 +18,10 @@
 * (is_function_default_version): Check target string.
 * TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS: New macro.

 -===
  2012-12-27  Steven Bosscher  ste...@gcc.gnu.org

 * cgraph.c (verify_cgraph_node): Don't allocate/free visited_nodes 
 set.

 - .r194729
  2012-12-25  John David Anglin  dave.ang...@nrc-cnrc.gc.ca

 PR target/53789
 diff --git a/gcc/target.def b/gcc/target.def
 index 79bb955..d0547be 100644
 --- a/gcc/target.def
 +++ b/gcc/target.def
 @@ -2839,7 +2839,7 @@ DEFHOOK
  (supports_function_versions,
   ,
   bool, (void),
 - hool_bool_void_false)
 + hook_bool_void_false)

 Thanks for the fix.

 -Sri.


  /* Function to determine if one function can inline another function.  */
  #undef HOOK_PREFIX
 --
 1.8.0.2


 --
 Andreas Schwab, sch...@linux-m68k.org
 GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
 And now for something completely different.