Re: [PATCH] Improve ifcombine (PR 52005)

2012-08-06 Thread Marc Glisse
Hello, do you have an opinion on this patch (available here: http://gcc.gnu.org/ml/gcc-patches/2012-07/msg01352.html ) ? Or should we go back to my old patch, or Andrew's patch? On Thu, 26 Jul 2012, Marc Glisse wrote: Hello, here is a new version of the ifcombine patch, which handles

[patch] speed up ifcvt:cond_move_convert_if_block

2012-08-06 Thread Steven Bosscher
Hello, In PR54146, ifcvt spends a lot of time just clearing memory. This patch changes the value maps to pointer-maps to fix this issue. Bootstrappedtested on x86_64-unknown-linux-gnu. OK? Ciao! Steven PR54146_ifcvt.diff Description: Binary data

Re: [Test] Fix for PRPR53981

2012-08-06 Thread Kirill Yukhin
Yes, you can put it on the 4.6 branch. Hi, Thanks! Checked into 4.6 branch. http://gcc.gnu.org/ml/gcc-cvs/2012-08/msg00130.html Thanks, K

[Ada] Missing Constraint_Error in illegal conversion to C type

2012-08-06 Thread Arnaud Charlet
This patch removes an old range check optimization which incorrectly assumes that the type of an arbitrary expression can always fit in the target type of a conversion. -- Source -- -- main.adb with Interfaces; use Interfaces; procedure Main is subtype

[Ada] Skip unneeded expansion for Alfa mode

2012-08-06 Thread Arnaud Charlet
In Alfa mode for formal verification, a special expansion done in the frontend turns out to be both harmful and unneeded, because the formal verification backend relies on the types of nodes (hence is not robust w.r.t. a change to base type here), and does not suffer from the out-of-order issue

[Ada] Skip special expansion in Alfa mode

2012-08-06 Thread Arnaud Charlet
In Alfa mode for formal verification, a special expansion of the iterator is not needed, as the formal verification backend directly deals with the source form of the iterator. Thus, skip this expansion. Tested on x86_64-pc-linux-gnu, committed on trunk 2012-08-06 Yannick Moy m...@adacore.com

[Ada] Redundant finalization of controlled function result

2012-08-06 Thread Arnaud Charlet
This patch removes obsolete code related to array initialization. When an array is initialized by an aggregate, the compiler may generate a loop to initialize all elements. If the aggregate contains controlled function calls, the loop statements are wrapped in a block for finalization purposes.

[Ada] Fix delayed analysis of aspect specification when scopes differ

2012-08-06 Thread Arnaud Charlet
This patch properly analyses aspects in cases when scopes differ such as protected types, tasks, etc. The test illustrates the analysis of aspects at freeze point specified for a protected object. -- Source -- package T is type Typ is new Integer with Size = 128;

[Ada] Guard against cascaded error when processing deferred config pragmas

2012-08-06 Thread Arnaud Charlet
Some configuration pragmas require the presence of a compilation unit context to be processed. Their analysis is deferred until after the main unit has been analyzed. However, if that analysis fails for any reason, then the context may not be correctly established, and the deferred config pragmas

[Ada] Incorrect parameter mechanism due to convention C_Pass_By_Copy

2012-08-06 Thread Arnaud Charlet
This patch corrects the Ada-C parameter passing mechanism for record types. OUT and IN OUT parameters are now unconditionally passed by reference regardless of whether C_Pass_By_Copy is in effect. IN parameters subject to the convention are passed by copy, otherwise they are passed by reference.

[Ada] Protected objects with interrupt handlers are legal in nested scopes

2012-08-06 Thread Arnaud Charlet
AI95-0303 removes the rule that protected objects with handlers must be declared at the library level. The AI is a binding interpretation, and thus applies to earlier versions of the language as well. The new rule is tested in ACATS test BXC3002. Tested on x86_64-pc-linux-gnu, committed on trunk

[Ada] Lock-free implementation of protected objects (PR ada/54125)

2012-08-06 Thread Arnaud Charlet
This patch removes dependency on Support_Atomic_Primitives in the run-time package System.Atomic_Primitives by introducing a new attribute Atomic_Always_Lock_Free. This changes allow us to remove all the Support_Atomic_Primitives defaulted values in the corresponding system packages and fixes

Re: [PATCH] Remove introduction of undefined overflow in emit_case_bit_test.

2012-08-06 Thread Richard Guenther
On Mon, Aug 6, 2012 at 1:31 AM, Tom de Vries tom_devr...@mentor.com wrote: Richard, the code in emit_case_bit_tests currently introduces a MINUS_EXPR in signed type (without checking if signed types wrap or not), which could mean introduction of undefined overflow. This patch fixes this

Re: [PATCH] Improve ifcombine (PR 52005)

2012-08-06 Thread Richard Guenther
On Mon, Aug 6, 2012 at 8:27 AM, Marc Glisse marc.gli...@inria.fr wrote: Hello, do you have an opinion on this patch (available here: http://gcc.gnu.org/ml/gcc-patches/2012-07/msg01352.html ) ? I like it. Thus, the referenced patch is ok for trunk. Thanks, Richard. Or should we go back

Re: [patch] speed up ifcvt:cond_move_convert_if_block

2012-08-06 Thread Richard Guenther
On Mon, Aug 6, 2012 at 8:54 AM, Steven Bosscher stevenb@gmail.com wrote: Hello, In PR54146, ifcvt spends a lot of time just clearing memory. This patch changes the value maps to pointer-maps to fix this issue. Bootstrappedtested on x86_64-unknown-linux-gnu. OK? Ok! Thanks, Richard.

[Ada] Implement extended overflow checks, step 1

2012-08-06 Thread Arnaud Charlet
This patch extends the type Suppress_Array in types.ads to include the switches to control extended overflow checking. The new type is called Suppress_Record, and all uses elsewhere of Suppress_Array are changed to be Suppress_Record. So far, the only settings for the new overflow checking modes

[Ada] In Alfa mode, issue an error instead of a warning on a missing component

2012-08-06 Thread Arnaud Charlet
In Alfa mode, there is no use in applying formal verification to a codebase with a blatant error such as an access to a component not present in the type, so make the default warning an error in this mode. Tested on x86_64-pc-linux-gnu, committed on trunk 2012-08-06 Yannick Moy

[Ada] Portability improvement for constants related to serial ports

2012-08-06 Thread Arnaud Charlet
This change improves the process that generates s-oscons.ads so that the proper unisgned values for serial ports related constants are generated. Tested on x86_64-pc-linux-gnu, committed on trunk 2012-08-06 Thomas Quinot qui...@adacore.com * s-oscons-tmplt.c, xoscons.adb: Per the

[Ada] Serial port flow control support

2012-08-06 Thread Arnaud Charlet
This change adds two new optional parameters to GNAT.Serial_Comminications.Set to allow the user to specify a local port (no modem control lines), and to choose a flow control method (none, hardware, software). Note that the default behaviour is now consistently no flow control on all platforms.

[Ada] Reject exponent of dimensioned operand that is unknown at compile-time

2012-08-06 Thread Arnaud Charlet
The test presented below illustrates the current patch. -- Source -- with System.Dim.Mks;use System.Dim.Mks; with System.Dim.Mks_IO; use System.Dim.Mks_IO; procedure Main is begin for N in -3 .. +3 loop Put (m**N , Aft = 2, Exp = 0); end loop; end Main;

[Ada] Inheritance of representation aspects at freezing point

2012-08-06 Thread Arnaud Charlet
The test presented below deals with the aspect Volatile. Indeed it's illegal to instantiate non-volatile formal object with volatile actual. -- Source -- package Volatile is type Volatile is tagged record R : Integer; end record with Volatile; -- Volatile

Re: [Patch, Fortran] PR 35831: checking for dummy procedures

2012-08-06 Thread Tobias Burnus
On 08/05/2012 11:12 PM, Janus Weil wrote: here is a patch for a rather old PR, which deals with correctness checking for several cases, such as: 1) dummy procedures 2) proc-ptr assignments 3) type-bound procedure overloading The patch adds a new function 'check_result_characteristics' to do

RFA: MN10300: Add support for -fstack-usage

2012-08-06 Thread Nick Clifton
Hi Jeff, Hi Alex, Please may I apply the small patch below to add support for reporting stack usage to the MN10300 port ? Cheers Nick gcc/ChangeLog 2012-08-06 Nick Clifton ni...@redhat.com * config/mn10300/mn10300.c (mn10300_expand_prologue): Report stack usage if

Re: [patch] speed up ifcvt:cond_move_convert_if_block

2012-08-06 Thread Paolo Bonzini
Il 06/08/2012 08:54, Steven Bosscher ha scritto: Hello, In PR54146, ifcvt spends a lot of time just clearing memory. This patch changes the value maps to pointer-maps to fix this issue. Bootstrappedtested on x86_64-unknown-linux-gnu. OK? Nice, but perhaps we need a sparsemap to do even

Re: [patch] one more sched-vis fix

2012-08-06 Thread Andrey Belevantsev
Hi Steven, On 03.08.2012 12:02, Steven Bosscher wrote: Hello, I also need to handle SEQUENCE, of course, or slim dumping fails in targets with branch delay slots. But who knew SEQUENCE can also appear as a REG_NOTE value?! The cfgrtl.c fix is purely cosmetic and obvious. Bootstrappedtested

Re: [patch] speed up ifcvt:cond_move_convert_if_block

2012-08-06 Thread Steven Bosscher
On Mon, Aug 6, 2012 at 1:07 PM, Paolo Bonzini bonz...@gnu.org wrote: Il 06/08/2012 08:54, Steven Bosscher ha scritto: Hello, In PR54146, ifcvt spends a lot of time just clearing memory. This patch changes the value maps to pointer-maps to fix this issue. Bootstrappedtested on

Re: [patch] one more sched-vis fix

2012-08-06 Thread Steven Bosscher
On Mon, Aug 6, 2012 at 1:16 PM, Andrey Belevantsev a...@ispras.ru wrote: Hi Steven, On 03.08.2012 12:02, Steven Bosscher wrote: Hello, I also need to handle SEQUENCE, of course, or slim dumping fails in targets with branch delay slots. But who knew SEQUENCE can also appear as a REG_NOTE

Re: [patch] speed up ifcvt:cond_move_convert_if_block

2012-08-06 Thread Paolo Bonzini
Il 06/08/2012 13:15, Steven Bosscher ha scritto: On Mon, Aug 6, 2012 at 1:07 PM, Paolo Bonzini bonz...@gnu.org wrote: Il 06/08/2012 08:54, Steven Bosscher ha scritto: Hello, In PR54146, ifcvt spends a lot of time just clearing memory. This patch changes the value maps to pointer-maps to fix

Re: cosmetic change - simplify cse.c:preferable()

2012-08-06 Thread Richard Guenther
On Sat, 4 Aug 2012, Dimitrios Apostolou wrote: On Thu, 19 Jul 2012, Richard Guenther wrote: I don't think it's any good or clearer to understand. Hi Richi, I had forgotten I prepared this for PR #19832, maybe you want to take a look. FWIW, with my patch applied there is a difference of

Re: [PATCH] Follow-up to the last gengtype patch: handle DEF_VEC_A in gengtype

2012-08-06 Thread Laurynas Biveinis
Ping? 2012/7/30 Laurynas Biveinis laurynas.bivei...@gmail.com: I only remembered to add DEF_VEC_A handlgin to gengtype.c a second after committing the previous patch [1]. Here it is, done as a follow up. With some luck, this will be short-lived code because of the C++ conversion.

Re: [Patch, Fortran] PR 35831: checking for dummy procedures

2012-08-06 Thread Janus Weil
Hi Tobias, thanks for the review! here is a patch for a rather old PR, which deals with correctness checking for several cases, such as: 1) dummy procedures 2) proc-ptr assignments 3) type-bound procedure overloading The patch adds a new function 'check_result_characteristics' to do

Huge change on 4.7 branch

2012-08-06 Thread H.J. Lu
Hi Nick, You checked a huge change into 4,7 branch: http://gcc.gnu.org/ml/gcc-cvs/2012-08/msg00149.html Is this an accident? -- H.J.

Re: Huge change on 4.7 branch

2012-08-06 Thread Richard Guenther
On Mon, Aug 6, 2012 at 3:25 PM, H.J. Lu hjl.to...@gmail.com wrote: Hi Nick, You checked a huge change into 4,7 branch: http://gcc.gnu.org/ml/gcc-cvs/2012-08/msg00149.html Is this an accident? I hope so. Please revert. Thanks, Richard. -- H.J.

Re: Huge change on 4.7 branch

2012-08-06 Thread nick clifton
Hi H.J.., Hi Richard, Change reverted. Sorry about the mess-up. I was trying to perform a local merge but I had my cached svn control directories the wrong way around. Doh. Cheers Nick

[PATCH - C++] Avoid crashing on erroneous static_assert usage

2012-08-06 Thread Dodji Seketeli
When working on something else, I noticed that failing to provide the second argument to the static_assert operator would lead to an ICE. Fixed thus, and tested against trunk on x86_64-unknown-linux-gnu. gcc/cp/ * semantics.c (finish_static_assert): Don't crash on erroneous

Re: [google/main] Add powerpc-grtev3-linux-gnu.xfail to contrib/testsuite-management (issue6447087)

2012-08-06 Thread Ollie Wild
OK. Don't forget to add xfail files for google/trunk and google/gcc-4_7, too. Ollie On Fri, Aug 3, 2012 at 9:14 AM, Simon Baldwin sim...@google.com wrote: Add powerpc-grtev3-linux-gnu.xfail to contrib/testsuite-management. Tested with build followed by validate_failures.py. 2012-08-03

Re: fix thinko in tree-emutls, breaking tls support on vxworks

2012-08-06 Thread Olivier Hainque
On Jul 16, 2012, at 19:48 , Richard Henderson wrote: * tree-emutls.c (new_emutls_decl): When a var_section is requested by the target, attach the new decl to that, not to the template section. Ok. rev 190179, after a couple of weeks off. Thanks :)

Re: RFA: MN10300: Add support for -fstack-usage

2012-08-06 Thread Jeff Law
On 08/06/2012 03:48 AM, Nick Clifton wrote: Hi Jeff, Hi Alex, Please may I apply the small patch below to add support for reporting stack usage to the MN10300 port ? Cheers Nick gcc/ChangeLog 2012-08-06 Nick Clifton ni...@redhat.com * config/mn10300/mn10300.c

RE: [PATCH - C++] Avoid crashing on erroneous static_assert usage

2012-08-06 Thread Jason Merrill
Ok. Original Message From: Dodji Seketeli do...@redhat.com Sent: Mon, Aug 6, 2012 10:49 AM To: Jason Merrill ja...@redhat.com CC: GCC Patches gcc-patches@gcc.gnu.org Subject: [PATCH - C++] Avoid crashing on erroneous static_assert usage When working on something else, I

Changed strucs to structs. (issue6442086)

2012-08-06 Thread Chris Manghane
This patch removes functions and structs necessary for gathering pmu info with pfmon, which is now a deprecated tool. For google/main. Tested with bootstrap. 2012-08-03 Chris Manghane cm...@google.com * libgcc/pmu-profile.c (enum pmu_tool_type): Remove pfmon-specific

Re: [google] Remove deprecated pfmon-specific functions/structs from pmu-profile.c (was: Changed strucs to structs) (issue6442086)

2012-08-06 Thread Teresa Johnson
Revised the subject to add [google] tag and add original patch description. Chris, you can use the same subject as the original patch and just describe the revisions to the patch in the email body. Thanks, Teresa On Mon, Aug 6, 2012 at 8:51 AM, Chris Manghane cm...@google.com wrote: This patch

Re: [google] Remove deprecated pfmon-specific functions/structs from pmu-profile.c (was: Changed strucs to structs) (issue6442086)

2012-08-06 Thread Teresa Johnson
The upload script asks for a subject, even when updating a previous issue number. Usually I just re-enter the original patch subject line, and describe the changes from the original in the patch description that I am uploading. You don't need to reload it again, it should all be tracked properly

Re: [PATCH 0/2] Convert s390 to atomic optabs, v2

2012-08-06 Thread Ulrich Weigand
Richard Henderson wrote: While the first set of changes looks good to me, I don't understand those: @@ -4728,7 +4733,12 @@ init_alignment_context (struct alignment_context *ac, rtx mem, ac-aligned = (MEM_ALIGN (mem) = GET_MODE_BITSIZE (SImode)); if (ac-aligned) -ac-memsi =

Re: [RFA, patch] Add missing source location info to thunks

2012-08-06 Thread Richard Henderson
On 08/03/2012 04:38 PM, Cary Coutant wrote: 2012-08-03 Cary Coutant ccout...@google.com * gcc/cgraphunit.c (assemble_thunk): Add source line info. * gcc/final.c (final): Check for non-null cfg pointer. I'm uncomfortable with just the one call into the debug generator, outside

Re: [PATCH 2/2] s390: Convert from sync to atomic optabs

2012-08-06 Thread Ulrich Weigand
Richard Henderson wrote: Some more comments on this patch. +; Different from movdi_31 in that we have no splitters. +(define_insn atomic_loaddi_1 + [(set (match_operand:DI 0 register_operand =d,d,!*f,!*f) + (unspec:DI [(match_operand:DI 1 s_operand Q,S,Q,m)] The constraint line

Re: [PATCH] put exception tables for comdat functions in comdat, too

2012-08-06 Thread Richard Henderson
On 08/05/2012 08:40 PM, Sandra Loosemore wrote: 2012-08-04 Paul Brook p...@codesourcery.com Sandra Loosemore san...@codesourcery.com gcc/ * except.c (switch_to_exception_section): Place tables for DECL_ONE_ONLY functions in comdat groups. Mostly ok. - s =

Re: [PATCH 2/2] s390: Convert from sync to atomic optabs

2012-08-06 Thread Richard Henderson
On 08/06/2012 11:34 AM, Ulrich Weigand wrote: Richard Henderson wrote: Some more comments on this patch. +; Different from movdi_31 in that we have no splitters. +(define_insn atomic_loaddi_1 + [(set (match_operand:DI 0 register_operand =d,d,!*f,!*f) +(unspec:DI [(match_operand:DI

Re: [PATCH 2/2] s390: Convert from sync to atomic optabs

2012-08-06 Thread Richard Henderson
On 08/06/2012 11:50 AM, Richard Henderson wrote: In the first patch I did, I had memory_operand and QS, but that ran into reload failures. I assumed I'd just made a mistake. I'll see if I can replicate this for your debugging enjoyment... I think I had written =S instead of =QS, which of

Re: [RFA, patch] Add missing source location info to thunks

2012-08-06 Thread Cary Coutant
I'm uncomfortable with just the one call into the debug generator, outside of the other debug_hooks begin/end calls. It'll obviously work for stabs, and probably work for sdb, due to how the debug info is represented. But for dwarf2 it probably only works for selected targets. For

Re: [Patch, Fortran] PR 35831: checking for dummy procedures

2012-08-06 Thread Janus Weil
With those changes, I am fine with the patch. Thanks. I will commit the attached version after another regtest - unless there are further complaints in the meantime. Committed as r190187 with some minor adjustments. Cheers, Janus 2012-08-05 Janus Weil ja...@gcc.gnu.org PR

Re: [RFA, patch] Add missing source location info to thunks

2012-08-06 Thread Cary Coutant
Richard, Try a target like arm-linux (which doesn't use final_end_function), and hack the generated auto-host.h so that HAVE_AS_DWARF2_DEBUG_LINE is undefined. Trying arm-unknown-linux-gnueabi now... I just built an ARM compiler and tried it out on my testcase. It generated this code for

Re: [RFA, patch] Add missing source location info to thunks

2012-08-06 Thread Cary Coutant
Here's a revised patch, with testcase added, and with Steven's suggested change... -cary 2012-08-06 Cary Coutant ccout...@google.com gcc/ * cgraphunit.c (assemble_thunk): Add source line info. * final.c (final): Check for non-null cfg pointer. *

Re: [RFA, patch] Add missing source location info to thunks

2012-08-06 Thread Richard Henderson
On 08/06/2012 02:45 PM, Cary Coutant wrote: Do you still have concerns about the patch? Nope. I'd mis-remembered from whence things get finalized. Revised patch is ok. r~

Re: [PATCH] Set correct source location for deallocator calls

2012-08-06 Thread Dehao Chen
Ping... Richard, could you shed some lights on this? Thanks, Dehao On Mon, Jul 30, 2012 at 8:29 PM, Dehao Chen de...@google.com wrote: Hi, This patch fixes the source location for automatically generated calls to deallocator. For example: 19 void foo(int i) 20 { 21 for (int j = 0;

s390: Avoid CAS boolean output inefficiency

2012-08-06 Thread Richard Henderson
On 08/06/2012 11:34 AM, Ulrich Weigand wrote: There is one particular inefficiency I have noticed. This code: if (!__atomic_compare_exchange_n (v, expected, max, 0 , 0, 0)) abort (); from atomic-compare-exchange-3.c gets compiled into: l %r3,0(%r2) larl

Re: [RFA, patch] Add missing source location info to thunks

2012-08-06 Thread Cary Coutant
Revised patch is ok. Thanks! Committed at r190190. -cary

[PATCH v3] s390: Convert from sync to atomic optabs

2012-08-06 Thread Richard Henderson
[ This ought to be exactly the patch you bootstrapped. It does not include the SEQ follow-up. ] Split out s390_two_part_insv from s390_expand_cs_hqi to try harder to use bit insertion instructions in the CAS loop. Reorg s390_expand_insv to aid that. Try RISBG last, after other mechanisms

[google/gcc-4_7] Backport patch to add line info to non-virtual thunks

2012-08-06 Thread Cary Coutant
This patch is for the google/gcc-4_7 branch. It backports the following patch from trunk at r190190: http://gcc.gnu.org/ml/gcc-patches/2012-08/msg00321.html GCC generates non-virtual thunks directly to assembly code, which causes a couple of problems. First, it doesn't add source location

Assembly output optimisations (was: PR 51094 - fprint_w() in output_addr_const() reinstated)

2012-08-06 Thread Dimitrios Apostolou
Hello list, these clean-ups and minor speedups complete some TODOs and semi-finished changes I have gathered in the ELF backend. In a nutshell: Fixed comment style, used INT_BITS_STRLEN_BOUND from gnulib to be future proof on integer representation string length, replaced long arguments in

Re: [PATCH] put exception tables for comdat functions in comdat, too

2012-08-06 Thread Sandra Loosemore
On 08/06/2012 11:45 AM, Richard Henderson wrote: On 08/05/2012 08:40 PM, Sandra Loosemore wrote: 2012-08-04 Paul Brookp...@codesourcery.com Sandra Loosemoresan...@codesourcery.com gcc/ * except.c (switch_to_exception_section): Place tables for DECL_ONE_ONLY functions

Re: Assembly output optimisations (was: PR 51094 - fprint_w() in output_addr_const() reinstated)

2012-08-06 Thread Hans-Peter Nilsson
On Tue, 7 Aug 2012, Dimitrios Apostolou wrote: Thanks Andreas, hp, Mike, for your comments. Mike I'd appreciate if you elaborated on how to speed-up sprint_uw_rev(), I don't think I understood what you have in mind. I just commented on comments and just above the nit-level; formatting and

add strnlen to libiberty (was Re: Assembly output optimisations)

2012-08-06 Thread Dimitrios Apostolou
As an addendum to my previous patch, I made an attempt to properly add strnlen() to libiberty, with the code copied from gnulib. Unfortunately it seems I've messed it up somewhere since defining HAVE_STRNLEN to 0 doesn't seem to build strnlen.o for me. Any ideas? Thanks, Dimitris ===

libgo patch committed: Support NumCPU on more platforms

2012-08-06 Thread Ian Lance Taylor
This patch to libgo, from Shenghou Ma, adds support for NumCPU on additional platforms: Solaris, Irix, *BSD, Darwin. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 12a361bc53d0 libgo/Makefile.am --- a/libgo/Makefile.am Mon Aug 06 21:39:47 2012

Re: add strnlen to libiberty (was Re: Assembly output optimisations)

2012-08-06 Thread Ian Lance Taylor
On Mon, Aug 6, 2012 at 9:34 PM, Dimitrios Apostolou ji...@gmx.net wrote: As an addendum to my previous patch, I made an attempt to properly add strnlen() to libiberty, with the code copied from gnulib. Unfortunately it seems I've messed it up somewhere since defining HAVE_STRNLEN to 0 doesn't

Re: add strnlen to libiberty (was Re: Assembly output optimisations)

2012-08-06 Thread Dimitrios Apostolou
On Mon, 6 Aug 2012, Ian Lance Taylor wrote: On Mon, Aug 6, 2012 at 9:34 PM, Dimitrios Apostolou ji...@gmx.net wrote: As an addendum to my previous patch, I made an attempt to properly add strnlen() to libiberty, with the code copied from gnulib. Unfortunately it seems I've messed it up