libobjc: Fixed gnu-api-2-objc.m testcase
This patch fixes two errors in the gnu-api-2-objc.m testcase for libobjc's Modern Objective-C API. One of them is that class_addIvar() was called with the alignment, instead of the log2 of the alignment, being passed as argument. The error slipped in because a previous, buggy version of libobjc's class_addIvar() didn't use the log2, and when fixing libobjc it seems I forgot to update this testcase. It's important to fix this in case people look at the testcase as an example of how to use the API. ;-) The other one is that a root class was created, and an instance of it instantiated, without the required "isa" instance variable to hold the Class. This error slipped in because the instantiation was added later without realizing the root class was a test, fake class without the required variable. This is more serious and could cause the testcase to fail under some conditions, depending on how the memory is allocated. This patch fixes it. :-) Committed to trunk. Thanks PS: I noticed that these testcases, and the gnu-api-2-class.m[m] ones, are failing on Apple m64. That's a separate issue and I'll submit a separate patch. Index: ChangeLog === --- ChangeLog (revision 174655) +++ ChangeLog (working copy) @@ -1,3 +1,10 @@ +2011-06-04 Nicola Pero + + * objc.dg/gnu-api-2-objc.m: Fixed testcase. Use log2 of the + alignment, not the alignment, when calling class_addIvar(). Add + an 'isa' instance variable to the test root class. + * obj-c++.dg/gnu-api-2-objc.mm: Likewise. + 2011-06-04 Jan Hubicka PR tree-optimization/48893 Index: objc.dg/gnu-api-2-objc.m === --- objc.dg/gnu-api-2-objc.m(revision 174655) +++ objc.dg/gnu-api-2-objc.m(working copy) @@ -45,7 +45,24 @@ - (id) variable { return variable_ivar; } @end +/* Hack to calculate the log2 of a byte alignment. */ +unsigned char +log_2_of (unsigned int x) +{ + unsigned char result = 0; + /* We count how many times we need to divide by 2 before we reach 1. + This algorithm is good enough for the small numbers (such as 8, + 16 or 64) that we have to deal with. */ + while (x > 1) +{ + x = x / 2; + result++; +} + + return result; +} + int main(int argc, void **args) { /* Functions are tested in alphabetical order. */ @@ -56,8 +73,9 @@ int main(int argc, void **args) Class new_class = objc_allocateClassPair (objc_getClass ("MyRootClass"), "MyNewSubClass", 0); /* A new root class would obviously need at least an 'isa' - instance variable. We don't add it so we never actually - instantiate an instance of the class, which wouldn't work. */ + instance variable. */ +class_addIvar (new_root_class, "isa", sizeof (Class), log_2_of (__alignof__ (Class)), + @encode (Class)); objc_registerClassPair (new_root_class); objc_registerClassPair (new_class); @@ -114,7 +132,7 @@ int main(int argc, void **args) /* Add a bit of everything to the class to exercise undoing all these changes. */ /* Instance variable. */ -class_addIvar (new_class, "my_variable", sizeof (float), __alignof__ (float), @encode (float)); +class_addIvar (new_class, "my_variable", sizeof (float), log_2_of (__alignof__ (float)), @encode (float)); /* Instance method. */ class_addMethod (new_class, @selector (setVariable:), method_getImplementation (method), Index: obj-c++.dg/gnu-api-2-objc.mm === --- obj-c++.dg/gnu-api-2-objc.mm(revision 174655) +++ obj-c++.dg/gnu-api-2-objc.mm(working copy) @@ -45,7 +45,24 @@ - (id) variable { return variable_ivar; } @end +/* Hack to calculate the log2 of a byte alignment. */ +unsigned char +log_2_of (unsigned int x) +{ + unsigned char result = 0; + /* We count how many times we need to divide by 2 before we reach 1. + This algorithm is good enough for the small numbers (such as 8, + 16 or 64) that we have to deal with. */ + while (x > 1) +{ + x = x / 2; + result++; +} + + return result; +} + int main () { /* Functions are tested in alphabetical order. */ @@ -56,8 +73,9 @@ int main () Class new_class = objc_allocateClassPair (objc_getClass ("MyRootClass"), "MyNewSubClass", 0); /* A new root class would obviously need at least an 'isa' - instance variable. We don't add it so we never actually - instantiate an instance of the class, which wouldn't work. */ + instance variable. */ +class_addIvar (new_root_class, "isa", sizeof (Class), log_2_of (__alignof__ (Class)), + @encode (Class)); objc_registerClassPair (new_root_class); objc_registerClassPair (new_class); @@ -114,7 +132,7 @@ int main () /* Add a bit of everything to the class to exercise
Fix for PR objc/49287
This patch fixes PR objc/49287. The problem is that enabling the compiler checks for missing @interfaces triggered a couple of warnings of missing @interfaces in some testcases (this only showed up with the NeXT runtime because objc_getClass() is treated specially only with the NeXT runtime; we haven't changed the GNU ABI yet). The patch adds a cast to the testcases to remove the warnings and fix the apparent regression. OK to commit ? Thanks PS: I spent time considering whether the compiler behaviour in terms of warnings needed improving in this specific case, and ended up thinking that it's fine as it is. It's a rare issue where our compiler currently behaves identically to the latest Apple GCC in terms of warnings. Apple clang doesn't behave in the same way, as it's unable to check method invocations based on the arguments of objc_getClass() like GCC does, and so can miss serious warnings if objc_getClass() is the receiver of a method invocation not supported by the class, but on the other hand, doesn't emit a warning when objc_getClass() is used as a receiver of a method invocation and the @interface of the class is not available. I wondered for a while if this last behaviour is slightly better, but it's unclear. In the end, I see no compelling reason to change anything. It's a very rare issue anyhow. I added comments to objc-act.c trying to summarize the issues involved so if in the future we want to change things, information is readily available. Index: gcc/objc/ChangeLog === --- gcc/objc/ChangeLog (revision 174624) +++ gcc/objc/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2011-06-05 Nicola Pero + + * objc-act.c (receiver_is_class_object): Expanded comment. + (objc_finish_message_expr): Likewise. + 2011-06-02 Nicola Pero PR objc/48539 Index: gcc/objc/objc-act.c === --- gcc/objc/objc-act.c (revision 174624) +++ gcc/objc/objc-act.c (working copy) @@ -5270,7 +5270,42 @@ receiver_is_class_object (tree receiver, int self, return exp; /* The receiver is a function call that returns an id. Check if - it is a call to objc_getClass, if so, pick up the class name. */ + it is a call to objc_getClass, if so, pick up the class name. + + This is required by the GNU runtime, which compiles + + [NSObject alloc] + + into + + [objc_get_class ("NSObject") alloc]; + + and then, to check that the receiver responds to the +alloc + method, needs to be able to determine that the objc_get_class() + call returns the NSObject class and not just a generic Class + pointer. + + But, traditionally this is enabled for all runtimes, not just the + GNU one, which means that the compiler is smarter than you'd + expect when dealing with objc_getClass(). For example, with the + Apple runtime, in the code + + [objc_getClass ("NSObject") alloc]; + + the compiler will recognize the objc_getClass() call as special + (due to the code below) and so will know that +alloc is called on + the 'NSObject' class, and can perform the corresponding checks. + + Programmers can disable this behaviour by casting the results of + objc_getClass() to 'Class' (this may seem weird because + objc_getClass() is already declared to return 'Class', but the + compiler treats it as a special function). This may be useful if + the class is never declared, and the compiler would complain + about a missing @interface for it. Then, you can do + + [(Class)objc_getClass ("MyClassNeverDeclared") alloc]; + + to silence the warnings. */ if (TREE_CODE (receiver) == CALL_EXPR && (exp = CALL_EXPR_FN (receiver)) && TREE_CODE (exp) == ADDR_EXPR @@ -5478,13 +5513,16 @@ objc_finish_message_expr (tree receiver, tree sel_ { /* If 'rtype' is NULL_TREE at this point it means that we have seen no @interface corresponding to that -class name, only a @class declaration. So, we have a -class name (class_tree) but no actual details of the -class methods. We won't be able to check that the -class responds to the method, and we will have to -guess the method prototype. Emit a warning, then -keep going (this will use any method with a matching -name, as if the receiver was of type 'Class'). */ +class name, only a @class declaration (alternatively, +this was a call such as [objc_getClass("SomeClass") +alloc], where we've never seen the @interface of +SomeClass). So, we have a class name (class_tree) +but no actual details of the class methods. We won't +be able to check that the class responds to the +m
Re: [PATCH] fixincludes/Makefile for Interix
On 06/04/11 13:43, Douglas B Rupp wrote: Here's my proposed patch, along the lines you suggested. Hi Doug, Excellent. Just a couple nits: It is more normal and easier to read when you quote the entire shell script fragment, as below (removing unnecessary "eval", too): diff -rupN gcc.orig/fixincludes/configure.ac gcc/fixincludes/configure.ac --- gcc.orig/fixincludes/configure.ac 2011-04-06 17:01:09.0 -0700 +++ gcc/fixincludes/configure.ac2011-06-04 13:18:23.0 -0700 @@ -23,6 +23,20 @@ ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual] # Determine the noncanonical target name, for directory use. ACX_NONCANONICAL_TARGET +[host_makefile_frag=/dev/null +if test -d ${srcdir}/../config ; then +case "${host}" in + *-interix[3-9]*) +host_makefile_frag="${srcdir}/../config/mh-interix" +;; +esac +fi] +AC_SUBST_FILE(host_makefile_frag) + # Specify the local prefix local_prefix= AC_ARG_WITH(local-prefix,
Re: -fdump-passes -fenable-xxx=func_name_list
Is this patch ok? Thanks, David On Wed, Jun 1, 2011 at 10:24 AM, Xinliang David Li wrote: > The attached is the split #1 patch that enhances -fenable/disable. > > Ok after testing? > > Thanks, > David > > On Wed, Jun 1, 2011 at 9:16 AM, Xinliang David Li wrote: >> On Wed, Jun 1, 2011 at 1:51 AM, Richard Guenther >> wrote: >>> On Wed, Jun 1, 2011 at 1:34 AM, Xinliang David Li >>> wrote: The following patch implements the a new option that dumps gcc PASS configuration. The sample output is attached. There is one limitation: some placeholder passes that are named with '*xxx' are note registered thus they are not listed. They are not important as they can not be turned on/off anyway. The patch also enhanced -fenable-xxx and -fdisable-xx to allow a list of function assembler names to be specified. Ok for trunk? >>> >>> Please split the patch. >>> >>> I'm not too happy how you dump the pass configuration. Why not simply, >>> at a _single_ place, walk the pass tree? Instead of doing pieces of it >>> at pass execution time when it's not already dumped - that really looks >>> gross. >> >> Yes, that was the original plan -- but it has problems >> 1) the dumper needs to know the root pass lists -- which can change >> frequently -- it can be a long term maintanance burden; >> 2) the centralized dumper needs to be done after option processing >> 3) not sure if gate functions have any side effects or have dependencies on >> cfun >> >> The proposed solutions IMHO is not that intrusive -- just three hooks >> to do the dumping and tracking indentation. >> >>> >>> The documentation should also link this option to the -fenable/disable >>> options as obviously the pass names in that dump are those to be >>> used for those flags (and not readily available anywhere else). >> >> Ok. >> >>> >>> I also think that it would be way more useful to note in the individual >>> dump files the functions (at the place they would usually appear) that >>> have the pass explicitly enabled/disabled. >> >> Ok -- for ipa passes or tree/rtl passes where all functions are >> explicitly disabled. >> >> Thanks, >> >> David >> >>> >>> Richard. >>> Thanks, David >>> >> >
Re: -fdump-passes -fenable-xxx=func_name_list
Is this one ok? Thanks, David On Thu, Jun 2, 2011 at 12:12 AM, Xinliang David Li wrote: > This is the version of the patch that walks through pass lists. > > Ok with this one? > > David > > On Wed, Jun 1, 2011 at 12:45 PM, Xinliang David Li wrote: >> On Wed, Jun 1, 2011 at 12:29 PM, Richard Guenther >> wrote: >>> On Wed, Jun 1, 2011 at 6:16 PM, Xinliang David Li >>> wrote: On Wed, Jun 1, 2011 at 1:51 AM, Richard Guenther wrote: > On Wed, Jun 1, 2011 at 1:34 AM, Xinliang David Li > wrote: >> The following patch implements the a new option that dumps gcc PASS >> configuration. The sample output is attached. There is one >> limitation: some placeholder passes that are named with '*xxx' are >> note registered thus they are not listed. They are not important as >> they can not be turned on/off anyway. >> >> The patch also enhanced -fenable-xxx and -fdisable-xx to allow a list >> of function assembler names to be specified. >> >> Ok for trunk? > > Please split the patch. > > I'm not too happy how you dump the pass configuration. Why not simply, > at a _single_ place, walk the pass tree? Instead of doing pieces of it > at pass execution time when it's not already dumped - that really looks > gross. Yes, that was the original plan -- but it has problems 1) the dumper needs to know the root pass lists -- which can change frequently -- it can be a long term maintanance burden; 2) the centralized dumper needs to be done after option processing 3) not sure if gate functions have any side effects or have dependencies on cfun The proposed solutions IMHO is not that intrusive -- just three hooks to do the dumping and tracking indentation. >>> >>> Well, if you have a CU that is empty or optimized to nothing at some point >>> you will not get a complete pass list. I suppose optimize attributes might >>> also confuse output. Your solution might not be that intrusive >>> but it is still ugly. I don't see 1) as an issue, for 2) you can just call >>> the >>> dumping from toplev_main before calling do_compile (), 3) gate functions >>> shouldn't have side-effects, but as they could gate on optimize_for_speed () >>> your option summary output will be bogus anyway. >>> >>> So - what is the output intended for if it isn't reliable? >> >> This needs to be cleaned up at some point -- the gate function should >> behave the same for all functions and per-function decisions need to >> be pushed down to the executor body. I will try to rework the patch >> as you suggested to see if there are problems. >> >> David >> >> >>> >>> Richard. >>> > > The documentation should also link this option to the -fenable/disable > options as obviously the pass names in that dump are those to be > used for those flags (and not readily available anywhere else). Ok. > > I also think that it would be way more useful to note in the individual > dump files the functions (at the place they would usually appear) that > have the pass explicitly enabled/disabled. Ok -- for ipa passes or tree/rtl passes where all functions are explicitly disabled. Thanks, David > > Richard. > >> Thanks, >> >> David >> > >>> >> >
Re: Fix for PR objc/49287
On Jun 5, 2011, at 6:07 AM, Nicola Pero wrote: > This patch fixes PR objc/49287. The problem is that enabling the compiler > checks > for missing @interfaces triggered a couple of warnings of missing @interfaces > in some > testcases (this only showed up with the NeXT runtime because objc_getClass() > is treated > specially only with the NeXT runtime; we haven't changed the GNU ABI yet). > > The patch adds a cast to the testcases to remove the warnings and fix the > apparent regression. > > OK to commit ? Ok.
Re: never ending output from -fdump-fortran-original on ENTRY statement
Hi Andreas, I have committed your patch with a slight variation to trunk as obvious after regression-testting. Will commit to 4.6 in a few days. No test case because we can't do test cases with -fdump-fortran-* at the moment. This patch is small enough so it does not need a copyright assignment, but you might want to consider obtaining one just the same. Thanks for working on this! Thomas 2011-06-05 Andreas Schmidt Thomas Koenig * dump-parse-tree.c (show_symbol): Don't dump namespace for ENTRY to avoid infinite recursion. Index: dump-parse-tree.c === --- dump-parse-tree.c (Revision 174391) +++ dump-parse-tree.c (Arbeitskopie) @@ -893,7 +893,8 @@ } if (sym->formal_ns && (sym->formal_ns->proc_name != sym) - && sym->attr.proc != PROC_ST_FUNCTION) + && sym->attr.proc != PROC_ST_FUNCTION + && !sym->attr.entry) { show_indent (); fputs ("Formal namespace", dumpfile);
[x32] PATCH: Document -mx32
Hi, I checked this patch into x32 branch. H.J. --- commit d1dfec734d8981b05873187443fd758abc93973a Author: H.J. Lu Date: Sun Jun 5 12:10:01 2011 -0700 Document -mx32. diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32 index 3a5b9e7..8c52f9d 100644 --- a/gcc/ChangeLog.x32 +++ b/gcc/ChangeLog.x32 @@ -1,3 +1,7 @@ +2011-06-05 H.J. Lu + + * doc/invoke.texi: Document -mx32. + 2011-05-24 H.J. Lu PR rtl-optimization/49114 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index a069042..12080ca 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -609,7 +609,7 @@ Objective-C and Objective-C++ Dialects}. -mpc32 -mpc64 -mpc80 -mstackrealign @gol -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol -mcmodel=@var{code-model} -mabi=@var{name} @gol --m32 -m64 -mlarge-data-threshold=@var{num} @gol +-m32 -m64 -mx32 -mlarge-data-threshold=@var{num} @gol -msse2avx -mfentry -m8bit-idiv @gol -mavx256-split-unaligned-load -mavx256-split-unaligned-store} @@ -12824,14 +12824,18 @@ on AMD x86-64 processors in 64-bit environments. @table @gcctabopt @item -m32 @itemx -m64 +@itemx -mx32 @opindex m32 @opindex m64 +@opindex mx32 Generate code for a 32-bit or 64-bit environment. -The 32-bit environment sets int, long and pointer to 32 bits and +The -m32 option sets int, long and pointer to 32 bits and generates code that runs on any i386 system. -The 64-bit environment sets int to 32 bits and long and pointer -to 64 bits and generates code for AMD's x86-64 architecture. For -darwin only the -m64 option turns off the @option{-fno-pic} and +The -m64 option sets int to 32 bits and long and pointer +to 64 bits and generates code for AMD's x86-64 architecture. +The -mx32 option sets int, long and pointer to 32 bits and generates +code for AMD's x86-64 architecture. +For darwin only the -m64 option turns off the @option{-fno-pic} and @option{-mdynamic-no-pic} options. @item -mno-red-zone
PATCH [1/n]: Add initial -x32 support
Hi, I'd like to start submitting a series of patches to enable x32: https://sites.google.com/site/x32abi/ The GCC x32 branch is very stable. There are no unexpected failures in C, C++, Fortran and Objective C testsuites. SPEC CPU 2K/2006 compile and run correctly at -O2 and -O3. More than 90% of changes are in x86 backend. This is the first patch to support x32. By default, x32 is disabled and x32 run-time support isn't required. OK for trunk? Thanks. H.J. --- 2011-06-05 H.J. Lu * config.gcc: Support --enable-x32/--enable-ia32 for x86 Linux targets. * configure.ac: Support --enable-x32/--enable-ia32. * configure: Regenerated. * config/i386/gnu-user64.h (ASM_SPEC): Support x32. (LINK_SPEC): Likewise. (TARGET_THREAD_SSP_OFFSET): Likewise. (TARGET_THREAD_SPLIT_STACK_OFFSET): Likewise. * config/i386/i386.h (TARGET_X32): New. (TARGET_LP64): New. (LONG_TYPE_SIZE): Likewise. (POINTER_SIZE): Likewise. (POINTERS_EXTEND_UNSIGNED): Likewise. * config/i386/i386.opt (mx32): New. * config/i386/linux64.h (GLIBC_DYNAMIC_LINKERX32): New. * config/i386/t-linux64-x32: New. * config/i386/t-linuxx32: Likewise. * config/linux.h (UCLIBC_DYNAMIC_LINKERX32): New. (BIONIC_DYNAMIC_LINKERX32): Likewise. (GNU_USER_DYNAMIC_LINKERX32): Likewise. * doc/invoke.texi: Document -mx32. diff --git a/gcc/config.gcc b/gcc/config.gcc index 624129b..24b4a57 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1232,7 +1232,17 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i if test x$enable_targets = xall; then tm_file="${tm_file} i386/x86-64.h i386/gnu-user64.h i386/linux64.h" tm_defines="${tm_defines} TARGET_BI_ARCH=1" - tmake_file="${tmake_file} i386/t-linux64" + case x${enable_x32}${enable_ia32} in + xyesyes) + tmake_file="${tmake_file} i386/t-linuxx32" + ;; + xyesno) + tmake_file="${tmake_file} i386/t-linux64-x32" + ;; + *) + tmake_file="${tmake_file} i386/t-linux64" + ;; + esac need_64bit_hwint=yes need_64bit_isa=yes case X"${with_cpu}" in @@ -1270,7 +1280,18 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu) x86_64-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu.h" ;; x86_64-*-knetbsd*-gnu) tm_file="${tm_file} knetbsd-gnu.h" ;; esac - tmake_file="${tmake_file} i386/t-linux64 i386/t-crtstuff i386/t-crtpc i386/t-crtfm t-dfprules" + case x${enable_x32}${enable_ia32} in + xyesyes) + tmake_file="${tmake_file} i386/t-linuxx32" + ;; + xyesno) + tmake_file="${tmake_file} i386/t-linux64-x32" + ;; + *) + tmake_file="${tmake_file} i386/t-linux64" + ;; + esac + tmake_file="${tmake_file} i386/t-crtstuff i386/t-crtpc i386/t-crtfm t-dfprules" ;; i[34567]86-pc-msdosdjgpp*) xm_file=i386/xm-djgpp.h diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h index 3ece0fa..b99fb13 100644 --- a/gcc/config/i386/gnu-user64.h +++ b/gcc/config/i386/gnu-user64.h @@ -65,17 +65,20 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif #undef ASM_SPEC -#define ASM_SPEC "%{" SPEC_32 ":--32} %{" SPEC_64 ":--64} \ +#define ASM_SPEC "%{" SPEC_32 ":%{!mx32:--32}} %{" \ + SPEC_64 ":%{!mx32:--64}} %{mx32:--x32} \ %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" #undef LINK_SPEC -#define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} \ +#define LINK_SPEC "%{" SPEC_64 ":%{!mx32:-m elf_x86_64}} %{" \ + SPEC_32 ":%{!mx32:-m elf_i386}} %{mx32:-m elf32_x86_64} \ %{shared:-shared} \ %{!shared: \ %{!static: \ %{rdynamic:-export-dynamic} \ - %{" SPEC_32 ":-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "} \ - %{" SPEC_64 ":-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}} \ + %{" SPEC_32 ":%{!mx32:-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \ + %{" SPEC_64 ":%{!mx32:-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}} \ + %{mx32:-dynamic-linker " GNU_USER_DYNAMIC_LINKERX32 "}} \ %{static:-static}}" /* Similar to standard GNU userspace, but adding -ffast-math support. */ @@ -109,10 +112,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #ifdef TARGET_LIBC_PROVIDES_SSP /* i386 glibc provides __stack_chk_guard in %gs:0x14, + x32 glibc provides it in %fs:0x
Re: [Patch, Fortran] Fix -fcheck=pointer for F2008's NULL ptr to optional arguments
*ping* On 1 June 2011, Tobias Burnus wrote: The NULL pointer check (-fcheck=pointer) was wrong for Fortran 2008: It is now allowed to pass a null pointer (or not associated allocatables) to optional arguments to denote absent arguments. Build and regtested on x86-64-linux. OK for the trunk? Tobias
[v3] fix typos in ptr_traits.h and specialize for pointer adapter
2011-06-05 Jonathan Wakely * include/bits/ptr_traits.h (pointer_traits): Fix typos. * include/ext/pointer.h (pointer_traits): Add partial specialization for _Pointer_adapter. This fixes a couple of dumb mistakes in pointer_traits (type vs __type and not actually declaring friends as friends) and adds a specialization for __gnu_cxx::_Pointer_adapter, which is needed because the default specialization gives the wrong result for pointer_traits::rebind, preventing _Pointer_adapter from being used by containers using the full C++0x allocator API (which I'm currently working on.) Tested x86_64-linux and committed to trunk. Index: include/bits/ptr_traits.h === --- include/bits/ptr_traits.h (revision 174624) +++ include/bits/ptr_traits.h (working copy) @@ -106,8 +106,8 @@ _GLIBCXX_HAS_NESTED_TYPE(difference_type /* TODO: remove second bool when alias templates are supported */ template::value, - bool = __ptrtr_rebind_helper2<_Tp, _Up>::value> + bool = __ptrtr_rebind_helper<_Tp, _Up>::__value, + bool = __ptrtr_rebind_helper2<_Tp, _Up>::__value> struct __ptrtr_rebind; template @@ -178,8 +178,9 @@ _GLIBCXX_HAS_NESTED_TYPE(difference_type { typedef typename __ptrtr_rebind<_Ptr, _Up>::__type __type; }; // allocator_traits needs to use __rebind - template struct allocator_traits; - template class __ptrtr_rebind_helper2; + template friend struct allocator_traits; + template friend struct pointer_traits; + template friend class __ptrtr_rebind_helper2; }; /** Index: include/ext/pointer.h === --- include/ext/pointer.h (revision 174624) +++ include/ext/pointer.h (working copy) @@ -42,6 +42,9 @@ #include #include #include +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +# include +#endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { @@ -567,4 +570,40 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template +struct pointer_traits<__gnu_cxx::_Pointer_adapter<_Storage_policy>> +{ + /// The pointer type + typedef __gnu_cxx::_Pointer_adapter<_Storage_policy> pointer; + /// The type pointed to + typedef typename pointer::element_typeelement_type; + /// Type used to represent the difference between two pointers + typedef typename pointer::difference_type difference_type; + + /* TODO: replace __rebind with alias template rebind */ + /* + template +using rebind<_Up> = typename __gnu_cxx::_Pointer_adapter< + typename pointer_traits<_Storage_policy>::rebind<_Up>> + */ + template +class __rebind +{ + typedef pointer_traits<_Storage_policy> _Policy_traits; + typedef typename _Policy_traits::template __rebind<_Up>::__type +_Rebound_policy; +public: + typedef typename __gnu_cxx::_Pointer_adapter<_Rebound_policy> __type; +}; +}; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace +#endif + #endif // _POINTER_H
Re: [Patch, Fortran] Fix -fcheck=pointer for F2008's NULL ptr to optional arguments
Hi Tobias, The NULL pointer check (-fcheck=pointer) was wrong for Fortran 2008: It is now allowed to pass a null pointer (or not associated allocatables) to optional arguments to denote absent arguments. Build and regtested on x86-64-linux. OK for the trunk? OK. Thanks for the patch! Thomas
[PATCH, i386]: Remaining FP moves cleanups
Hello! 2011-06-05 Uros Bizjak * config/i386/i386.md (*movdf_internal_rex64) : Remove MODE_TI handling. Remove SSE1 handling in attribute "mode" calculation. (*movdf_internal_rex64) : Remove MODE_TI handling. Simplify MODE_V1DF and MODE_V2SF handling. (*movsf_internal): Remove x constraint from operand 1 alternative 7. Simplify MODE_SF handling. Patch was bootstrapped and regression tested on x86_64-pc-linux-gnuj {,-m32} AVX target. Committed to mainline SVN. Uros. Index: i386.md === --- i386.md (revision 174655) +++ i386.md (working copy) @@ -2956,9 +2956,6 @@ case 10: switch (get_attr_mode (insn)) { - case MODE_TI: - if (!TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL) - return "%vmovdqa\t{%1, %0|%0, %1}"; case MODE_V2DF: if (!TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL) return "%vmovapd\t{%1, %0|%0, %1}"; @@ -2970,8 +2967,7 @@ case MODE_DF: if (TARGET_AVX && REG_P (operands[0]) && REG_P (operands[1])) return "vmovsd\t{%1, %0, %0|%0, %0, %1}"; - else - return "%vmovsd\t{%1, %0|%0, %1}"; + return "%vmovsd\t{%1, %0|%0, %1}"; case MODE_V1DF: return "%vmovlpd\t{%1, %d0|%d0, %1}"; case MODE_V2SF: @@ -3014,13 +3010,6 @@ (eq_attr "alternative" "3,4,5,6,11,12") (const_string "DI") - /* For SSE1, we have many fewer alternatives. */ - (eq (symbol_ref "TARGET_SSE2") (const_int 0)) -(cond [(eq_attr "alternative" "7,8") - (const_string "V4SF") - ] - (const_string "V2SF")) - /* xorps is one byte shorter. */ (eq_attr "alternative" "7") (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)") @@ -3099,9 +3088,6 @@ case 8: switch (get_attr_mode (insn)) { - case MODE_TI: - if (!TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL) - return "%vmovdqa\t{%1, %0|%0, %1}"; case MODE_V2DF: if (!TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL) return "%vmovapd\t{%1, %0|%0, %1}"; @@ -3113,18 +3099,11 @@ case MODE_DF: if (TARGET_AVX && REG_P (operands[0]) && REG_P (operands[1])) return "vmovsd\t{%1, %0, %0|%0, %0, %1}"; - else - return "%vmovsd\t{%1, %0|%0, %1}"; + return "%vmovsd\t{%1, %0|%0, %1}"; case MODE_V1DF: - if (TARGET_AVX && REG_P (operands[0])) - return "vmovlpd\t{%1, %0, %0|%0, %0, %1}"; - else - return "%vmovlpd\t{%1, %0|%0, %1}"; + return "%vmovlpd\t{%1, %d0|%d0, %1}"; case MODE_V2SF: - if (TARGET_AVX && REG_P (operands[0])) - return "vmovlps\t{%1, %0, %0|%0, %0, %1}"; - else - return "%vmovlps\t{%1, %0|%0, %1}"; + return "%vmovlps\t{%1, %d0|%d0, %1}"; default: gcc_unreachable (); } @@ -3150,9 +3129,9 @@ /* For SSE1, we have many fewer alternatives. */ (eq (symbol_ref "TARGET_SSE2") (const_int 0)) -(cond [(eq_attr "alternative" "5,6") - (const_string "V4SF") - ] +(if_then_else + (eq_attr "alternative" "5,6") + (const_string "V4SF") (const_string "V2SF")) /* xorps is one byte shorter. */ @@ -3195,9 +3174,9 @@ (define_insn "*movsf_internal" [(set (match_operand:SF 0 "nonimmediate_operand" - "=f,m,f,?r ,?m,x,x,x ,m,!*y,!m,!*y,?Yi,?r,!*Ym,!r") + "=f,m,f,?r ,?m,x,x,x,m,!*y,!m,!*y,?Yi,?r,!*Ym,!r") (match_operand:SF 1 "general_operand" - "fm,f,G,rmF,Fr,C,x,xm,x,m ,*y,*y ,r ,Yi,r ,*Ym"))] + "fm,f,G,rmF,Fr,C,x,m,x,m ,*y,*y ,r ,Yi,r ,*Ym"))] "!(MEM_P (operands[0]) && MEM_P (operands[1])) && (!can_create_pseudo_p () || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) @@ -3228,23 +3207,24 @@ case 6: if (get_attr_mode (insn) == MODE_V4SF) return "%vmovaps\t{%1, %0|%0, %1}"; - else - return "%vmovss\t{%1, %d0|%d0, %1}"; + case 7: - if (TARGET_AVX && REG_P (operands[1])) - return "vmovss\t{%1, %0, %0|%0, %0, %1}"; - else - return "%vmovss\t{%1, %0|%0, %1}"; case 8: + if (TARGET_AVX && REG_P (operands[0]) && REG_P (operands[1])) + return "vmovss\t{%1, %0, %0|%0, %0, %1}"; return "%vmovss\t{%1, %0|%0, %1}"; -case 9: case 10: case 14: case 15: +case 9: +case 10: +case 14: +case 15: return "movd\t{%1, %0|%0, %1}"; case 11: return "movq\t{%1, %0|%0, %1}"; -case 12: case 13: +case 12: +case 13: return "%vmovd\t{%1, %0|%0, %1}"; default:
[patch, fortran]
Hello world, the attached patch extends removing trailing TRIMs in assignments for cases like a // trim(b). Regression-tested. OK for trunk? Thomas 2011-05-06 Thomas König * frontend-passes.c (optimize_assignment): Follow chains of concatenation operators to the end for removing trailing TRIMS for assignments. 2011-05-06 Thomas König * gfortran.dg/trim_optimize_7.f90: New test. Index: frontend-passes.c === --- frontend-passes.c (Revision 174391) +++ frontend-passes.c (Arbeitskopie) @@ -500,6 +500,14 @@ optimize_assignment (gfc_code * c) if (lhs->ts.type == BT_CHARACTER) { + /* Check for a // b // trim(c). Looping is probably not + necessary because the parser usually generates + (// (// a b ) trim(c) ) , but better safe than sorry. */ + + while (rhs->expr_type == EXPR_OP + && rhs->value.op.op == INTRINSIC_CONCAT) + rhs = rhs->value.op.op2; + if (rhs->expr_type == EXPR_FUNCTION && rhs->value.function.isym && rhs->value.function.isym->id == GFC_ISYM_TRIM) ! { dg-do run } ! { dg-options "-O -fdump-tree-original" } ! Check that trailing trims are also removed from assignment of ! expressions involving concatenations of strings . program main character(2) :: a,b,c character(8) :: d a = 'a ' b = 'b ' c = 'c ' d = a // b // a // trim(c) ! This should be optimized away. if (d /= 'a b a c ') call abort d = a // trim(b) // c // a ! This shouldn't. if (d /= 'a bc a ') call abort d = a // b // a // trim(trim(c)) ! This should also be optimized away. if (d /= 'a b a c ') call abort end ! { dg-final { scan-tree-dump-times "string_len_trim" 1 "original" } }
Re: [trunk<-vta] Re: [vtab] Permit coalescing of user variables
On Jun 4, 2011, Jakub Jelinek wrote: > The following changes all look wrong to me, they make the tests totally > useless. If both f and g are used in real code after the asm volatile, then > the both f and g will likely live in some register or memory. > The whole point of the construct in the tests is that f has at that spot > a reg or mem location, but g isn't present anywhere anymore (as the compiler > doesn't or shouldn't know that asm volatile hasn't changed f), thus it > should represent them as bswap/clz/ctz/rotate. I see. I'll try to figure out why that didn't work. Maybe the input operands were clobbered or something, or maybe g used to be saved elsewhere before and now it no longer is. -- 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 Compiler Engineer
[pph] Clean up PPH tests (issue4572042)
The purpose of this patch is to make PPH testing clean. Some tests have assembly comparison failures between regular compiles and PPH compiles. When this miscompare is exected, we now mark the test with a comment "pph asm xdiff". The driver lib/dg-pph.exp looks for this comment to report either FAIL or XFAIL. Test p1mean.cc enters infinite recursion. Instead of disabling the test with a syntax error, we now run it under a dg-timeout. Test c1return-5.h was trying to grep assembly, but since we produce pre-parsed headers, not assembly, the test was in error. We have moved the assembly check to c1return-5.cc where it belongs. All PPH tests expected to have PPH compilation failures are marked with // { dg-xfail-if "comment" { "*-*-*" } { "-fpph-map=pph.map" } } The regular compiles do not have the -fpph-map option, and hence are not expected to fail. One test has a comment INFINITE; one test has a comment BOGUS; and the rest have a comment ICE. The driver lib/dg-pph.exp test control logic now stops a test when any compilation fails to produce assembly output. If the test file contains the above directive, that compilation failure is expected and reported as such. Otherwise, it is reported as an unexpected failure. PPH is wrongly producing ICEs and errors. We mark applicable messages with dg-bogus. Because the line/column information is often wrong, we mark the with a line of "0", which avoids line comparisons. We also prune output as needed. All tests are now either PASS or XFAIL, with the exception of unavoidable bogus XPASS messages for "test for bogus messages" and "test for excess errors". These are unavoidable because they cannot be conditionalized based on compiler options, and they do not appear in regular compiles. If you run the output of make check-c++ RUNTESTFLAGS=pph.exp through sed -e ' /^XPASS: .*test for bogus messages/ d /^XPASS: .*test for excess errors/ d /^#/p /^ERROR: / p /^XFAIL: / p /^XPASS: / p /^FAIL: / p d ' you should get no individual tests listed. Index: gcc/testsuite/ChangeLog.pph 2011-06-05 Lawrence Crowl * lib/dg-pph.exp (dg-pph-hdr): Add blank lines to logfile. Format if statements and calls consistently. (dg-pph-neg): Remove extraneous assembly files. Add blank lines to logfile. Format if statements and calls consistently. (dg-pph-pos): Stop test when a compilation fails. Recognize expected failing compilations. Recognize expected assembly miscompares. Parenthesize failure notes. Remove extraneous assembly files. Add blank lines to logfile. Format if statements and calls consistently. * g++.dg/pph/c1simple.cc: Add comment "pph asm xdiff" indicating expected assembly difference failure. Add line spacing to test. * g++.dg/pph/c1struct.cc: Likewise. * g++.dg/pph/c1variables.cc: Likewise. * g++.dg/pph/c2builtin1.cc: Likewise. * g++.dg/pph/x1globalref.cc: Likewise. * g++.dg/pph/x1hardlookup.cc: Likewise. * g++.dg/pph/x1struct1.cc: Likewise. * g++.dg/pph/x1struct2.cc: Likewise. * g++.dg/pph/x2nontrivinit.cc: Likewise. * c120060625-1.h: Add dg-xfail-if for -fpph-map. Add bogus message for ICE. Prune output. Add line spacing to text. * g++.dg/pph/c120060625-1.cc: Likewise. * g++.dg/pph/c1eabi1.h: Likewise. * g++.dg/pph/c1eabi1.cc: Likewise. * g++.dg/pph/x1autometh.cc: Likewise. * g++.dg/pph/x1functions.cc: Likewise. * g++.dg/pph/x1special.cc: Likewise. * g++.dg/pph/x1template.cc: Likewise. * g++.dg/pph/x1tmplclass.cc: Likewise. * g++.dg/pph/x1tmplfunc.cc: Likewise. * g++.dg/pph/x1typerefs.cc: Likewise. * g++.dg/pph/x1variables.cc: Likewise. * g++.dg/pph/p1mean.cc: Change syntax error preventing infinite recursion to a dg-timeout. Add dg-xfail-if for -fpph-map. * g++.dg/pph/c1return-5.h: Remove dg-final as we do not generate assembly on compiling headers. Change dg directive location. * g++.dg/pph/c1return-5.cc: Add dg-final as we _do_ generate assembly on compiling sources. Copy up dg-options from c1return-5.h as well. Index: gcc/testsuite/lib/dg-pph.exp === --- gcc/testsuite/lib/dg-pph.exp(revision 174608) +++ gcc/testsuite/lib/dg-pph.exp(working copy) @@ -24,13 +24,14 @@ proc dg-pph-hdr { subdir test options ma global runtests dg-do-what-default # If we're only testing specific files and this isn't one of them, skip it. -if ![runtest_file_p $runtests $test] { +if { ![runtest_file_p $runtests $test] } { return } set nshort "$subdir/[file tail $test]" set bname "[file rootname [file tail $nshort]]" -
Re: PR 49145: Another (zero_extend (const_int ...)) in combine
> PR rtl-optimization/49145 > * combine.c (make_compound_operation): Handle ZERO_EXTEND specially. > > gcc/testsuite/ > PR rtl-optimization/49145 > From Ryan Mansfield > * gcc.c-torture/compile/pr49145.c: New test. OK, thanks. -- Eric Botcazou
Re: fix latent compare-debug problem in cprop
> This patch fixes the problem, disregarding changes to debug insns as > “changed”. Regstrapped on x86_64-linux-gnu and i686-linux-gnu. Ok to > install? Yes, thanks. -- Eric Botcazou
[SPARC] Fix another thinko
This time introduced when -fno-delayed-branch was fixed in the back-end. Modifying %fp before a 'restore' instruction is a no-no because it is the base address used to reload spilled registers when the window stack is empty. It only affects __builtin_eh_return and presumably went unnoticed. Tested on SPARC/Solaris 8, applied on the mainline and 4.6/4.5/4.4 branches. 2011-06-05 Eric Botcazou * config/sparc/sparc.c (output_return): Fix thinko in the output of an EH return when delayed branches are disabled. -- Eric Botcazou Index: config/sparc/sparc.c === --- config/sparc/sparc.c (revision 174637) +++ config/sparc/sparc.c (working copy) @@ -4752,18 +4752,20 @@ output_return (rtx insn) machinery occupies the delay slot. */ gcc_assert (! final_sequence); - if (! flag_delayed_branch) - fputs ("\tadd\t%fp, %g1, %fp\n", asm_out_file); + if (flag_delayed_branch) + { + if (TARGET_V9) + fputs ("\treturn\t%i7+8\n", asm_out_file); + else + fputs ("\trestore\n\tjmp\t%o7+8\n", asm_out_file); - if (TARGET_V9) - fputs ("\treturn\t%i7+8\n", asm_out_file); + fputs ("\t add\t%sp, %g1, %sp\n", asm_out_file); + } else - fputs ("\trestore\n\tjmp\t%o7+8\n", asm_out_file); - - if (flag_delayed_branch) - fputs ("\t add\t%sp, %g1, %sp\n", asm_out_file); - else - fputs ("\t nop\n", asm_out_file); + { + fputs ("\trestore\n\tadd\t%sp, %g1, %sp\n", asm_out_file); + fputs ("\tjmp\t%o7+8\n\t nop\n", asm_out_file); + } } else if (final_sequence) {
Patch: aesthetics for gcc/cp/cxx-pretty-print.c
It also caused a code analysis tool to wander off into the weeds. 2011-06-05 Bruce Korb * gcc/cp/cxx-pretty-print.c (pp_cxx_decl_specifier_seq): Do not have a switch label pointing into an "else" clause for an "if". Index: gcc/cp/cxx-pretty-print.c === --- gcc/cp/cxx-pretty-print.c (revision 174678) +++ gcc/cp/cxx-pretty-print.c (working copy) @@ -1199,13 +1199,16 @@ case FUNCTION_DECL: /* Constructors don't have return types. And conversion functions -do not have a type-specifier in their return types. */ + do not have a type-specifier in their return types. */ + if (DECL_CONSTRUCTOR_P (t) || DECL_CONV_FN_P (t)) - pp_cxx_function_specifier (pp, t); - else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t)) - pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (t))); - else - default: +pp_cxx_function_specifier (pp, t), break; + + if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t)) +pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (t))), break; + /* FALLTHROUGH */ + +default: pp_c_declaration_specifiers (pp_c_base (pp), t); break; }
Re: [trunk<-vta] Re: [vtab] Permit coalescing of user variables
On Jun 5, 2011, Alexandre Oliva wrote: > On Jun 4, 2011, Jakub Jelinek wrote: >> The following changes all look wrong to me, they make the tests totally >> useless. If both f and g are used in real code after the asm volatile, then >> the both f and g will likely live in some register or memory. >> The whole point of the construct in the tests is that f has at that spot >> a reg or mem location, but g isn't present anywhere anymore (as the compiler >> doesn't or shouldn't know that asm volatile hasn't changed f), thus it >> should represent them as bswap/clz/ctz/rotate. > I see. I'll try to figure out why that didn't work. So, I tried to duplicate the problem and failed. The cut&pasto fix r174632 fixed the only two cases that had failed, on x86_64-linux-gnu and only at -O1. I suppose the wrong bit width made the expression unsuitable for a rotate or debug expr, but the fix made the tests pass again, so I withdraw the “fixes” for those testcases: they work even with coalescing fully enabled. Thanks for catching this. -- 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 Compiler Engineer
Add myself to MAINTAINERS
Added myself to MAINTAINERS. Thanks. 2011-06-05 Nenad Vukicevic * MAINTAINERS (Write After Approval): Add myself. Index: MAINTAINERS === --- MAINTAINERS (revision 174678) +++ MAINTAINERS (working copy) @@ -498,6 +498,7 @@ David Ung dav...@mips.com Neil Vachharajani nvach...@gmail.com Kris Van Hees kris.van.h...@oracle.com +Nenad Vukicevic ne...@intrepid.com Feng Wang fengw...@nudt.edu.cn Stephen M. Webb stephen.w...@bregmasoft.com John Wehle j...@feith.com
[pph] TS_COMMON chain and trace edits (issue4564058)
We were not streaming the TS_COMMON field change. This patch adds a functions to stream TS_COMMON. It adds calls to them in existing code that handles trees. It also implements streaming of other C++-specific trees that inherit TS_COMMON. This patch fixes some ICEs, but the test still fail on later ICEs. Tests adjusted to reflect new reality. Tested on x86-64. Committed. Index: gcc/testsuite/ChangeLog.pph 2011-06-05 Lawrence Crowl * g++.dg/pph/x1special.cc: Change to new ICE. * g++.dg/pph/x1template.cc: Change old ICE to new location. * g++.dg/pph/x1tmplfunc.cc: Change to new ICE. Index: gcc/cp/ChangeLog.pph 2011-06-05 Lawrence Crowl * pph-streamer.c (pph_trace): Clean up trace formatting. * pph-streamer-in.c (pph_in_tree_common): New for TS_COMMON chain. (pph_read_tree): Call pph_in_tree_common in existing readers for trees. Implement readers for C++-specific trees that need pph_in_tree_common. * pph-streamer-out.c (pph_out_tree_common): New for TS_COMMON chain. (pph_write_tree): Call pph_out_tree_common in existing writers for trees. Implement readers for C++-specific trees that need pph_out_tree_common. Index: gcc/testsuite/g++.dg/pph/x1tmplfunc.cc === --- gcc/testsuite/g++.dg/pph/x1tmplfunc.cc (revision 174669) +++ gcc/testsuite/g++.dg/pph/x1tmplfunc.cc (working copy) @@ -1,5 +1,5 @@ // { dg-xfail-if "ICE" { "*-*-*" } { "-fpph-map=pph.map" } } -// { dg-bogus "x1tmplfunc.h:12:30: internal compiler error: Segmentation fault" "" { xfail *-*-* } 0 } +// { dg-bogus "x1tmplfunc.h:8:16: internal compiler error: Segmentation fault" "" { xfail *-*-* } 0 } // { dg-prune-output "In file included from " } #include "x1tmplfunc.h" Index: gcc/testsuite/g++.dg/pph/x1special.cc === --- gcc/testsuite/g++.dg/pph/x1special.cc (revision 174669) +++ gcc/testsuite/g++.dg/pph/x1special.cc (working copy) @@ -1,5 +1,5 @@ // { dg-xfail-if "ICE" { "*-*-*" } { "-fpph-map=pph.map" } } -// { dg-bogus "x1special.h:19:6: internal compiler error: tree check: expected tree that contains 'decl minimal' structure, have 'overload' in context_for_name_lookup, at cp/search.c:570" "" { xfail *-*-* } 0 } +// { dg-bogus "x1special.h:10:5: internal compiler error: Segmentation fault" "" { xfail *-*-* } 0 } // { dg-prune-output "In file included from " } #include "x1special.h" Index: gcc/testsuite/g++.dg/pph/x1template.cc === --- gcc/testsuite/g++.dg/pph/x1template.cc (revision 174669) +++ gcc/testsuite/g++.dg/pph/x1template.cc (working copy) @@ -1,5 +1,5 @@ // { dg-xfail-if "ICE" { "*-*-*" } { "-fpph-map=pph.map" } } -// { dg-bogus "x1template.h:18:13: internal compiler error: in resume_scope, at cp/name-lookup.c:1573" "" { xfail *-*-* } 0 } +// { dg-bogus "x1template.h:18:13: internal compiler error: in resume_scope, at cp/name-lookup.c:1567" "" { xfail *-*-* } 0 } // { dg-prune-output "In file included from " } #include "x1template.h" Index: gcc/cp/pph-streamer-in.c === --- gcc/cp/pph-streamer-in.c(revision 174669) +++ gcc/cp/pph-streamer-in.c(working copy) @@ -484,6 +484,15 @@ pph_in_binding_level (pph_stream *stream } +/* Read in the tree_common fields. */ + +static void +pph_in_tree_common (pph_stream *stream, tree t) +{ + /* The 'struct tree_typed typed' base class is handled in LTO. */ + TREE_CHAIN (t) = pph_in_tree (stream); +} + /* Read and return an instance of struct c_language_function from STREAM. */ static struct c_language_function * @@ -1007,6 +1016,7 @@ pph_read_tree (struct lto_input_block *i /* tcc_exceptional */ case OVERLOAD: + pph_in_tree_common (stream, expr); OVL_FUNCTION (expr) = pph_in_tree (stream); break; @@ -1021,12 +1031,14 @@ pph_read_tree (struct lto_input_block *i break; case BASELINK: + pph_in_tree_common (stream, expr); BASELINK_BINFO (expr) = pph_in_tree (stream); BASELINK_FUNCTIONS (expr) = pph_in_tree (stream); BASELINK_ACCESS_BINFO (expr) = pph_in_tree (stream); break; case TEMPLATE_INFO: + pph_in_tree_common (stream, expr); TI_TYPEDEFS_NEEDING_ACCESS_CHECKING (expr) = pph_in_qual_use_vec (stream); break; @@ -1034,6 +1046,7 @@ pph_read_tree (struct lto_input_block *i case TEMPLATE_PARM_INDEX: { template_parm_index *p = TEMPLATE_PARM_INDEX_CAST (expr); +pph_in_tree_common (stream, expr); p->index = pph_in_uint (stream); p->level = pph_in_uint (stream); p->orig_level = pph_in_uint (stream); @@ -1044,6 +1057,56 @@ pph_read_tree (struct lto_input_block *i } break; +/* tcc_constant */ + +
Committed: fix PR49285, breakage building libgcc2 for MMIX
I needed a baseline for PR48542 (problems with setjmp/longjmp), but building MMIX was broken on trunk. It was "bitten" by the fixups to predicate matching done recentlish. The comment above the MMIX truncdfsf2 expander complains about having to use an expander to force an operand to memory - and then goes on and uses memory_operand for that operand anyway! That accidentally worked before the fixup, because after copying the failing operand to a new pseudo, the expander was called without the optabs machinery doublechecking the new pseudo against the predicate. While I stand by the comment and still think the optabs machinery could automatically fix up operands as needed to force an operand into memory when the predicate says so, it hasn't worked like that before, and I guess it's no use adding something like that just for one port, where an expander will do. Committed after building and regtesting for MMIX, where the build failed in libgcc2.c. FWIW, there's a whopping 252 regressions on the 4.6-branch and 256 on trunk (after this patch) according to Geoff's test-script compared to gcc-4.5 era, with "just" 1..6 regressions for the 4.3, 4.4 and 4.5 branches. Ouch. gcc: PR target/49285 * config/mmix/mmix.md ("truncdfsf2", "extendsfdf2"): Correct predicate to nonimmediate_operand from memory_operand for the operand that is to be forced to memory by the expander. Lose the constraints. Index: gcc/config/mmix/mmix.md === --- gcc/config/mmix/mmix.md (revision 174376) +++ gcc/config/mmix/mmix.md (working copy) @@ -625,8 +625,8 @@ (define_insn "fixuns_truncdfdi2" ;; define_expand with the old pattern as "anonymous". ;; FIXME: Perhaps with SECONDARY_MEMORY_NEEDED? (define_expand "truncdfsf2" - [(set (match_operand:SF 0 "memory_operand" "") - (float_truncate:SF (match_operand:DF 1 "register_operand" "")))] + [(set (match_operand:SF 0 "nonimmediate_operand") + (float_truncate:SF (match_operand:DF 1 "register_operand")))] "" " { @@ -660,8 +660,8 @@ (define_insn "*truncdfsf2_real" ;; Same comment as for truncdfsf2. (define_expand "extendsfdf2" - [(set (match_operand:DF 0 "register_operand" "=r") - (float_extend:DF (match_operand:SF 1 "memory_operand" "m")))] + [(set (match_operand:DF 0 "register_operand") + (float_extend:DF (match_operand:SF 1 "nonimmediate_operand")))] "" " { brgds, H-P
C++ PATCH for objc++/49221 (many EH fails in objc++ testsuite)
This was happening because objc_eh_runtime_type wanted to create global decls while we were in the middle of processing a function, and cp_finish_decl assumed that if we're in a function the decl must belong to the function. We can avoid that assumption by checking the DECL_CONTEXT rather than current scope. Tested x86_64-pc-linux-gnu, applying to trunk. commit ea2b4023d77cbb75ffdb0f71fec35d366b759a70 Author: Jason Merrill Date: Sun Jun 5 23:42:13 2011 -0400 PR objc++/49221 * decl.c (cp_finish_decl): Check DECL_FUNCTION_SCOPE_P rather than at_function_scope_p. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 232b5cf..30f70d9 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6190,7 +6190,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, /* Add this declaration to the statement-tree. This needs to happen after the call to check_initializer so that the DECL_EXPR for a reference temp is added before the DECL_EXPR for the reference itself. */ - if (at_function_scope_p ()) + if (DECL_FUNCTION_SCOPE_P (decl)) add_decl_expr (decl); /* Let the middle end know about variables and functions -- but not
C++ PATCH for c++/49134 (constexpr failures on ARM)
build_target_expr was making the assumption that the initializer for a temporary should have the same type as the temporary, but that isn't the case on ARM, where the ABI is changed to return 'this' from constructors. So I adjusted the assert. Tested x86_64-pc-linux-gnu, applying to trunk and 4.6. commit 36e8e35be7b42ec47b46364a385accfc8af9e93b Author: Jason Merrill Date: Thu Jun 2 14:35:53 2011 -0400 PR c++/49134 * tree.c (build_target_expr): Deal with ARM ABI tweaks. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 11e195e..025fe2d 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -292,6 +292,9 @@ build_target_expr (tree decl, tree value, tsubst_flags_t complain) #ifdef ENABLE_CHECKING gcc_assert (VOID_TYPE_P (TREE_TYPE (value)) || TREE_TYPE (decl) == TREE_TYPE (value) + /* On ARM ctors return 'this'. */ + || (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE + && TREE_CODE (value) == CALL_EXPR) || useless_type_conversion_p (TREE_TYPE (decl), TREE_TYPE (value))); #endif
AIX net/if_arp.h include fix for struct fc_softc
Hi, We ran across an issue with qt-4.7 built with gcc-4.4 on AIX 5.2, 5.3, 6.1, and 7.1 where some static constructors were not being called. It turned out to be a header file issue, see, for example, https://www.ibm.com/developerworks/forums/thread.jspa?threadID=211873&tstart=-2 Using fixincludes to fix the header allows us to build a working qt. The erroneous struct declaration is: struct fc_softc { struct arpcom fc_ac; /* FCS common part */ struct ndd*nddp;/* returned from NS*/ int(*efcnet_arp_fct) (struct ndd *, struct mbuf *); /* efcnet_arp function address */ } *fc_softc ; when fixed it becomes: typedef struct _fc_softc { struct arpcom fc_ac; /* FCS common part */ struct ndd*nddp;/* returned from NS*/ int(*efcnet_arp_fct) (struct ndd *, struct mbuf *); /* efcnet_arp function address */ } *fc_softc ; David, do you have any idea if this is what it's supposed to be? Ok for trunk? Peter -- Peter O'Gorman po...@thewrittenword.com Index: ChangeLog === --- ChangeLog (revision 174678) 2011-??-?? Peter O'Gorman * inclhack.def (aix_net_if_arp): New fix. * fixincl.x: Regenerate. * tests/base/net/if_arp.h [AIX_NET_IF_ARP_CHECK]: New test. Index: inclhack.def === --- inclhack.def(revision 174678) +++ inclhack.def(working copy) @@ -369,6 +369,19 @@ test_text = "#define _Complex_I__I\n"; }; +/* + * net/if_arp.h defines a variable fc_softc instead of adding a + * typedef for the struct on AIX 5.2, 5.3, 6.1 and 7.1 + */ +fix = { +hackname = aix_net_if_arp; +mach = "*-*-aix*"; +files = "net/if_arp.h"; +select= "^struct fc_softc \\{"; +c_fix = format; +c_fix_arg = "typedef struct _fc_softc {"; +test_text = "struct fc_softc {"; +}; /* * pthread.h on AIX 4.3.3 tries to define a macro without whitspace
Re: Patch: aesthetics for gcc/cp/cxx-pretty-print.c
On Sun, 05 Jun 2011 19:17:48 -0700 Bruce Korb wrote: > It also caused a code analysis tool to wander off into the weeds. > + if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t)) > +pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (t))), break; > + /* FALLTHROUGH */ I believe the usual GCC style is using braces, e.g if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t)) { pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (t))); break; } /* FALLTHROUGH */ -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basilestarynkevitchnet mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} ***
Re: fix left-over debug insns in DCE
On Jun 3, 2011, Eric Botcazou wrote: >> Hmm... Maybe it could, I'm not sure. The problem is that DCE removes >> insns, and then DF associates remaining uses in debug insns to earlier >> DEFs. Adjusting debug insns in DCE is right per the VTA design motto: >> decide as if debug insns weren't there, adjust them as you would adjust >> non-debug insns. This code borrowed from DF into DCE is the “adjust” >> bit. > But DCE isn't the only pass that removes insns. Yup. > Does the same logic need to be replicated in all passes that do? Those that remove sets whose DESTs may still be receved by debug insns ought to adjust debug insns, yeah. I think (hope) we have them all covered. Do you know of any we missed? > On the other hand, these passes call into DF when they remove insns, > so DF is a central place here. It might be too late for DF to do anything sensible to preserve the debug info rather than just throw it away, as your partial approval suggests. >> Err... These depend on the interface changes of functions defined >> within DF to work. > No, they don't, I can compile them independently. Indeed, sorry, I misread it. -- 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 Compiler Engineer
patch trunk: seek plugin also in a language specific directory when given a short name
Hello All, Sorry I incorrectly sent that to gcc@ not to gcc-patches@ Front-end functions (e.g. pragma-related) are not available to all plugins (e.g. not to plugins fired from lto1). See the http://gcc.gnu.org/ml/gcc/2011-05/msg00321.html discussion. This patch document a little bit that, and search short plugins like -fplugin=name in both `gcc -print-file-name=plugin`/name.so and `gcc -print-file-name=plugin`/cc1/name.so or `gcc -print-file-name=plugin`/cc1plus/name.so or `gcc -print-file-name=plugin`/lto1/name.so etc .. # gcc/ChangeLog entries 2011-06-06 Basile Starynkevitch * doc/plugins.texi (Loading plugins): Plugins are also seeked in a front-end specific subdirectory. (Plugin callbacks): lto1 plugins can't register pragma handlers. * plugin.c: Update copyright year. (PLUGIN_FILE_SUFFIX): New constant macro. (add_new_plugin): Search short plugins also in a front-end specific subdirectory. # Attaching patch to trunk 174684 Comments are welcome. Ok for trunk? Regards. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basilestarynkevitchnet mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} *** Index: gcc/doc/plugins.texi === --- gcc/doc/plugins.texi (revision 174684) +++ gcc/doc/plugins.texi (working copy) @@ -23,10 +23,14 @@ plugins as key-value pairs. Multiple plugins can b specifying multiple @option{-fplugin} arguments. A plugin can be simply given by its short name (no dots or -slashes). When simply passing @option{-fplugin=@var{name}}, the plugin is -loaded from the @file{plugin} directory, so @option{-fplugin=@var{name}} is -the same as @option{-fplugin=`gcc -print-file-name=plugin`/@var{name}.so}, -using backquote shell syntax to query the @file{plugin} directory. +slashes). When simply passing @option{-fplugin=@var{name}}, the plugin +is loaded from the @file{plugin} directory using if needed a front-end +specific subdirectory, so @option{-fplugin=@var{name}} is the same as +@option{-fplugin=`gcc -print-file-name=plugin`/@var{program}/@var{name}.so} or +@option{-fplugin=`gcc -print-file-name=plugin`/@var{name}.so}, using +backquote shell syntax to query the @file{plugin} directory, where +@var{program} is one of @code{cc1}, @code{cc1plus}, @code{lto1} etc. +This permits some plugins to be available only to some front-ends. @section Plugin API @@ -207,10 +211,11 @@ For the PLUGIN_PASS_MANAGER_SETUP, PLUGIN_INFO, PL and PLUGIN_REGISTER_GGC_CACHES pseudo-events the @code{callback} should be null, and the @code{user_data} is specific. -When the PLUGIN_PRAGMAS event is triggered (with a null -pointer as data from GCC), plugins may register their own pragmas -using functions like @code{c_register_pragma} or -@code{c_register_pragma_with_expansion}. +When the PLUGIN_PRAGMAS event is triggered (with a null pointer as +data from GCC), plugins may register their own pragmas using functions +like @code{c_register_pragma} or +@code{c_register_pragma_with_expansion}. This is not possible in +plugins run from @code{lto1}. @section Interacting with the pass manager Index: gcc/plugin.c === --- gcc/plugin.c (revision 174684) +++ gcc/plugin.c (working copy) @@ -1,5 +1,5 @@ /* Support for GCC plugin mechanism. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -117,6 +117,12 @@ get_plugin_base_name (const char *full_name) } +/* FIXME: the ".so" suffix is currently builtin, since plugins + only work on ELF host systems like e.g. Linux or Solaris. + When plugins shall be available on non ELF systems such as + Windows or MacOS, this code has to be greatly improved. */ +#define PLUGIN_FILE_SUFFIX ".so" + /* Create a plugin_name_args object for the given plugin and insert it to the hash table. This function is called when -fplugin=/path/to/NAME.so or -fplugin=NAME option is processed. */ @@ -140,17 +146,37 @@ add_new_plugin (const char* plugin_name) if (name_is_short) { + char *plugpath; + char* foundpath = NULL; base_name = CONST_CAST (char*, plugin_name); - /* FIXME: the ".so" suffix is currently builtin, since plugins - only work on ELF host systems like e.g. Linux or Solaris. - When plugins shall be available on non ELF systems such as - Windows or MacOS, this code has to be greatly improved. */ - plugin_name = concat (default_plugin_dir_name (), "/", - plugin_name, ".so", NULL); - if (access (plugin_name, R_OK)) + + /* Look for PLUGINDIR/PROGNAME/NAME.so. This is useful for + front-end specific plugins. */ +
Re: fix left-over debug insns in DCE
On Mon, Jun 06, 2011 at 02:32:29AM -0300, Alexandre Oliva wrote: > Those that remove sets whose DESTs may still be receved by debug insns > ought to adjust debug insns, yeah. I think (hope) we have them all > covered. Do you know of any we missed? delete_trivially_dead_insns is already covered, fast DCE is what I've encountered to be missing in the past (see PR48886), but I guess your patch covers both fast DCE and ud DCE. Jakub
Re: fix latent compare-debug problem in cprop
On Jun 4, 2011, Steven Bosscher wrote: > I'm curious, though: What CFG changes or other transformations are > performed without this patch? It could be a sign of a missed > optimization before CPROP. Have you looked at that too? IIRC the transformation that was possible but that hadn't been performed yet involved merging two blocks (I remember block numbering was off after cprop, and that there were cfgoptimize notes in its -g dumps, but not in the non-g dumps), but I didn't look any further than that. -- 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 Compiler Engineer