[PATCH] go.test: update MIPS architecture names

2017-06-23 Thread James Cowgill
Hi,

This updates the go architecture names on MIPS in line with the recent
changes to libgo.

I do not have commit access, so please can someone else commit this for
me.

Thanks,
James

2016-06-23  James Cowgill  <james.cowg...@imgtec.com>

* go.test/go-test.exp (go-set-goarch): update MIPS architecture
names.
---
 gcc/testsuite/go.test/go-test.exp | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/gcc/testsuite/go.test/go-test.exp 
b/gcc/testsuite/go.test/go-test.exp
index 5f6ef299e55..4b10e4e2d16 100644
--- a/gcc/testsuite/go.test/go-test.exp
+++ b/gcc/testsuite/go.test/go-test.exp
@@ -213,29 +213,27 @@ proc go-set-goarch { } {
#error FOO
#endif
}] {
-   set goarch "mipso32"
+   set goarch "mips"
} elseif [check_no_compiler_messages mipsn32 assembly {
#if _MIPS_SIM != _ABIN32
#error FOO
#endif
}] {
-   set goarch "mipsn32"
+   set goarch "mips64p32"
} elseif [check_no_compiler_messages mipsn64 assembly {
#if _MIPS_SIM != _ABI64
#error FOO
#endif
}] {
-   set goarch "mipsn64"
-   } elseif [check_no_compiler_messages mipso64 assembly {
-   #if _MIPS_SIM != _ABIO64
-   #error FOO
-   #endif
-   }] {
-   set goarch "mipso64"
+   set goarch "mips64"
} else {
perror "$target_triplet: unrecognized MIPS ABI"
return ""
}
+
+   if [istarget "mips*el-*-*"] {
+   append goarch "le"
+   }
}
"powerpc*-*-*" {
if [check_effective_target_ilp32] {
-- 
2.13.1


Re: libgo patch committed: Fix ptrace implementation on MIPS

2017-06-23 Thread James Cowgill
Hi,

On 22/06/17 20:59, Ian Lance Taylor wrote:
> James, any thoughts?
> 
> Ian
> 
> On Thu, Jun 22, 2017 at 12:55 AM, Andreas Schwab  wrote:
>> On Jun 21 2017, Ian Lance Taylor  wrote:
>>
>>> Index: libgo/sysinfo.c
>>> ===
>>> --- libgo/sysinfo.c   (revision 249205)
>>> +++ libgo/sysinfo.c   (working copy)
>>> @@ -102,6 +102,9 @@
>>>  #if defined(HAVE_LINUX_NETLINK_H)
>>>  #include 
>>>  #endif
>>> +#if defined(HAVE_LINUX_PTRACE_H)
>>> +#include 
>>> +#endif
>>>  #if defined(HAVE_LINUX_RTNETLINK_H)
>>>  #include 
>>>  #endif
>>
>> That breaks ia64:
>>
>> In file included from /usr/include/asm/ptrace.h:58:0,
>>  from /usr/include/linux/ptrace.h:69,
>>  from ../../../libgo/sysinfo.c:106:
>> /usr/include/asm/fpu.h:57:8: error: redefinition of 'struct ia64_fpreg'
>>  struct ia64_fpreg {
>> ^~
>> In file included from /usr/include/signal.h:339:0,
>>  from 
>> /usr/local/gcc/gcc-20170622/Build/gcc/include-fixed/sys/ucontext.h:32,
>>  from /usr/include/ucontext.h:27,
>>  from ../../../libgo/sysinfo.c:17:
>> /usr/include/bits/sigcontext.h:32:8: note: originally defined here
>>  struct ia64_fpreg
>> ^~
>> In file included from /usr/include/linux/ptrace.h:69:0,
>>  from ../../../libgo/sysinfo.c:106:
>> /usr/include/asm/ptrace.h:208:8: error: redefinition of 'struct 
>> pt_all_user_regs'
>>  struct pt_all_user_regs {
>> ^~~~
>> In file included from ../../../libgo/sysinfo.c:66:0:
>> /usr/include/sys/ptrace.h:116:8: note: originally defined here
>>  struct pt_all_user_regs
>> ^~~~

This looks like this glibc bug which was fixed in 2.19.
https://sourceware.org/bugzilla/show_bug.cgi?id=762

James



signature.asc
Description: OpenPGP digital signature


Re: [PATCH] [ADA] Fix bootstrap failure on mips64el-linux-gnuabi64

2017-03-13 Thread James Cowgill
Hi,

On 11/03/17 12:11, Arnaud Charlet wrote:
>> This patch fixes an error caused by my changing of the signal constants
>> on MIPS in r244026. While that patch worked on mipsel, ada fails to
>> bootstrap with it on mips64el with the error:
>>
>> s-osinte.ads:610:07: component "sa_flags" overlaps "sa_handler" at
>> line 608
>> ../gcc-interface/Makefile:297: recipe for target 'a-dispat.o' failed
>> make[9]: *** [a-dispat.o] Error 1
>>
>> The fix is to adjust the size of sa_flags in struct_sigaction from an
>> unsigned long to an int. I checked the glibc sources and sa_flags is an
>> int on all Linux arches.
> 
> Patch is OK, thanks.

Can you commit it for me?

James

>> gcc/ada/Changelog:
>>
>> 2017-03-10  James Cowgill  <james.cowg...@imgtec.com>
>>
>>  * s-osinte-linux.ads (struct_sigaction): Use correct type for
>>  sa_flags.



[PATCH] [ADA] Fix bootstrap failure on mips64el-linux-gnuabi64

2017-03-10 Thread James Cowgill
Hi,

This patch fixes an error caused by my changing of the signal constants
on MIPS in r244026. While that patch worked on mipsel, ada fails to
bootstrap with it on mips64el with the error:

s-osinte.ads:610:07: component "sa_flags" overlaps "sa_handler" at line 608
../gcc-interface/Makefile:297: recipe for target 'a-dispat.o' failed
make[9]: *** [a-dispat.o] Error 1

The fix is to adjust the size of sa_flags in struct_sigaction from an
unsigned long to an int. I checked the glibc sources and sa_flags is an
int on all Linux arches.

Thanks,
James

gcc/ada/Changelog:

2017-03-10  James Cowgill  <james.cowg...@imgtec.com>

* s-osinte-linux.ads (struct_sigaction): Use correct type for sa_flags.


diff --git a/gcc/ada/s-osinte-linux.ads b/gcc/ada/s-osinte-linux.ads
index ee1809e2ec1..b0ba2296398 100644
--- a/gcc/ada/s-osinte-linux.ads
+++ b/gcc/ada/s-osinte-linux.ads
@@ -182,7 +182,7 @@ package System.OS_Interface is
type struct_sigaction is record
   sa_handler  : System.Address;
   sa_mask : sigset_t;
-  sa_flags: Interfaces.C.unsigned_long;
+  sa_flags: int;
   sa_restorer : System.Address;
end record;
pragma Convention (C, struct_sigaction);
@@ -607,8 +607,7 @@ private
for struct_sigaction use record
   sa_handler at Linux.sa_handler_pos range 0 .. Standard'Address_Size - 1;
   sa_maskat Linux.sa_mask_posrange 0 .. 1023;
-  sa_flags   at Linux.sa_flags_pos
-range 0 .. Interfaces.C.unsigned_long'Size - 1;
+  sa_flags   at Linux.sa_flags_pos   range 0 .. int'Size - 1;
end record;
--  We intentionally leave sa_restorer unspecified and let the compiler
--  append it after the last field, so disable corresponding warning.
-- 
2.11.0


Re: [PATCH] [PR rtl-optimization/65618] Fix MIPS ADA bootstrap failure

2017-01-12 Thread James Cowgill
On 11/01/17 17:22, Maciej W. Rozycki wrote:
> On Wed, 11 Jan 2017, James Cowgill wrote:
> 
>>>  From this consideration I gather you have a program source which can be 
>>> used as a test case to reproduce the issue, so can you please file a 
>>> problem report and include the source and a recipe to reproduce it?  Is 
>>> this a GCC issue with generated assembly or a GAS issue with interpreting
>>> it?
>>
>> Yes I had a testcase which I used to debug this, but it was pretty huge
>> (and written in ADA). When debugging I just diffed it with the debug
>> information toggled to see if the patch fixed it. I'll see if I can find
>> it anyway.
> 
>  A test case being huge is not an issue, we can always try to reduce it if 
> needed.  What is key is reproducibility.  Please make sure it's 
> self-contained, i.e. doesn't depend on system-installed components (for 
> C/C++ I'd ask for a preprocessed source, but I'm not sure offhand what the 
> requirements are for ADA -- it's been a while since I did anything about 
> ADA, and even then not a huge lot -- just a GCC 3.4 MIPS port).

Filed as PR/79071

James


Re: [PATCH] [PR rtl-optimization/65618] Fix MIPS ADA bootstrap failure

2017-01-11 Thread James Cowgill
Hi,

On 11/01/17 16:49, Maciej W. Rozycki wrote:
> On Mon, 19 Dec 2016, James Cowgill wrote:
>> This bug causes the ADA bootstrap comparison failure in a-except.o
>> because the branch delay scheduling operates slightly differently for
>> that file if debug information is turned on.
> 
>  This looks like a bug to me -- actual code produced is supposed to be the 
> same regardless of the amount of debug information requested.  This is 
> important for some debugging scenarios, such as when a binary originally 
> produced with no debug information crashes and a core file is obtained so 
> that the program can be rebuilt with debug information included and then 
> matched to the core file previously produced, which may not be easy to 
> recreate with the rebuilt binary.
> 
>  From this consideration I gather you have a program source which can be 
> used as a test case to reproduce the issue, so can you please file a 
> problem report and include the source and a recipe to reproduce it?  Is 
> this a GCC issue with generated assembly or a GAS issue with interpreting
> it?

Yes I had a testcase which I used to debug this, but it was pretty huge
(and written in ADA). When debugging I just diffed it with the debug
information toggled to see if the patch fixed it. I'll see if I can find
it anyway.

The issue was about the assembly GCC generated.

James


[PATCH 2/2] [ADA] Fix constants in s-linux-mips.ads

2017-01-03 Thread James Cowgill
Hi,

This patch corrects various constants in s-linux-mips.ads. A large
proportion (especially the signals) were simply wrong on MIPS. It also
fixes the struct sigaction offsets which are incorrect on 64-bit
systems because sa_flags is an int (always 32-bits), and not a pointer.

Thanks,
James

gcc/ada/Changelog:

2017-01-03  James Cowgill  <james.cowg...@imgtec.com>

* s-linux-mips.ads: Use correct signal and errno constants.
(sa_handler_pos, sa_mask_pos): Fix offsets for 64-bit MIPS.

diff --git a/gcc/ada/s-linux-mips.ads b/gcc/ada/s-linux-mips.ads
index 17a3375ccce..f10f35caff9 100644
--- a/gcc/ada/s-linux-mips.ads
+++ b/gcc/ada/s-linux-mips.ads
@@ -26,7 +26,7 @@
 --  --
 --
 
---  This is the mipsel version of this package
+--  This is the mips version of this package
 
 --  This package encapsulates cpu specific differences between implementations
 --  of GNU/Linux, in order to share s-osinte-linux.ads.
@@ -43,6 +43,7 @@ package System.Linux is
-- Time --
--
 
+   subtype int is Interfaces.C.int;
subtype longis Interfaces.C.long;
subtype suseconds_t is Interfaces.C.long;
subtype time_t  is Interfaces.C.long;
@@ -69,7 +70,7 @@ package System.Linux is
EINVAL: constant := 22;
ENOMEM: constant := 12;
EPERM : constant := 1;
-   ETIMEDOUT : constant := 110;
+   ETIMEDOUT : constant := 145;
 
-
-- Signals --
@@ -82,45 +83,52 @@ package System.Linux is
SIGTRAP: constant := 5; --  trace trap (not reset)
SIGIOT : constant := 6; --  IOT instruction
SIGABRT: constant := 6; --  used by abort, replace SIGIOT in the  future
+   SIGEMT : constant := 7; --  EMT
SIGFPE : constant := 8; --  floating point exception
SIGKILL: constant := 9; --  kill (cannot be caught or ignored)
-   SIGBUS : constant := 7; --  bus error
+   SIGBUS : constant := 10; --  bus error
SIGSEGV: constant := 11; --  segmentation violation
+   SIGSYS : constant := 12; --  bad system call
SIGPIPE: constant := 13; --  write on a pipe with no one to read it
SIGALRM: constant := 14; --  alarm clock
SIGTERM: constant := 15; --  software termination signal from kill
-   SIGUSR1: constant := 10; --  user defined signal 1
-   SIGUSR2: constant := 12; --  user defined signal 2
-   SIGCLD : constant := 17; --  alias for SIGCHLD
-   SIGCHLD: constant := 17; --  child status change
-   SIGPWR : constant := 30; --  power-fail restart
-   SIGWINCH   : constant := 28; --  window size change
-   SIGURG : constant := 23; --  urgent condition on IO channel
-   SIGPOLL: constant := 29; --  pollable event occurred
-   SIGIO  : constant := 29; --  I/O now possible (4.2 BSD)
-   SIGLOST: constant := 29; --  File lock lost
-   SIGSTOP: constant := 19; --  stop (cannot be caught or ignored)
-   SIGTSTP: constant := 20; --  user stop requested from tty
-   SIGCONT: constant := 18; --  stopped process has been continued
-   SIGTTIN: constant := 21; --  background tty read attempted
-   SIGTTOU: constant := 22; --  background tty write attempted
-   SIGVTALRM  : constant := 26; --  virtual timer expired
-   SIGPROF: constant := 27; --  profiling timer expired
-   SIGXCPU: constant := 24; --  CPU time limit exceeded
-   SIGXFSZ: constant := 25; --  filesize limit exceeded
-   SIGUNUSED  : constant := 31; --  unused signal (GNU/Linux)
-   SIGSTKFLT  : constant := 16; --  coprocessor stack fault (Linux)
+   SIGUSR1: constant := 16; --  user defined signal 1
+   SIGUSR2: constant := 17; --  user defined signal 2
+   SIGCLD : constant := 18; --  alias for SIGCHLD
+   SIGCHLD: constant := 18; --  child status change
+   SIGPWR : constant := 19; --  power-fail restart
+   SIGWINCH   : constant := 20; --  window size change
+   SIGURG : constant := 21; --  urgent condition on IO channel
+   SIGPOLL: constant := 22; --  pollable event occurred
+   SIGIO  : constant := 22; --  I/O now possible (4.2 BSD)
+   SIGSTOP: constant := 23; --  stop (cannot be caught or ignored)
+   SIGTSTP: constant := 24; --  user stop requested from tty
+   SIGCONT: constant := 25; --  stopped process has been continued
+   SIGTTIN: constant := 26; --  background tty read attempted
+   SIGTTOU: constant := 27; --  background tty write attempted
+   SIGVTALRM  : constant := 28; --  virtual timer expired
+   SIGPROF: constant := 29; --  profiling timer expired
+   SIGXCPU: constant := 30; --  CPU time limit exceeded
+   SIGXFSZ: constant := 31; --  filesize limit exceeded
+
SIGLTHRRES : constant := 32; --  GNU/LinuxThreads restart signal
SIGLTHRCAN : constant := 33; --  GNU/LinuxThreads cancel signal
SIGLTHRDBG : constant

Re: [PATCH 1/2] [ADA] Fix MIPS big-endian build

2017-01-03 Thread James Cowgill
Hi,

On 03/01/17 14:47, Arnaud Charlet wrote:
>> This patch merges the mips and mipsel sections in
>> gcc-interface/Makefile.in favoring the existing variables in mipsel.
>> Over time, the mipsel target was tested much more than the mips target
>> and a number of fixes were applied which should have been applied to
>> both. Since the only real difference between mips and mipsel is the
>> endianness, it makes sense to merge them together and add an extra ifeq
>> for the one file which does differ with endianness.
>>
>> I don't have commit access.
>>
>> Thanks,
>> James
>>
>> gcc/ada/Changelog:
>>
>> 2017-01-03  James Cowgill  <james.cowg...@imgtec.com>
>>
>>  * s-linux-mips.ads: Rename from s-linux-mipsel.ads.
>>  * gcc-interface/Makefile.in (MIPS/Linux): Merge mips and mipsel
>>  sections.
> 
> Changes look OK to me.

Thanks, can you commit it for me? I screwed up the patch in the email I
sent a few minutes ago but the patch below should apply.

James

gcc/ada/Changelog:

2017-01-03  James Cowgill  <james.cowg...@imgtec.com>

* s-linux-mips.ads: Rename from s-linux-mipsel.ads.
* gcc-interface/Makefile.in (MIPS/Linux): Merge mips and mipsel
sections.

diff --git a/gcc/ada/gcc-interface/Makefile.in 
b/gcc/ada/gcc-interface/Makefile.in
index 98889c0f30f..b47a16c8b41 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1813,36 +1813,12 @@ ifeq ($(strip $(filter-out cygwin% mingw32% 
pe,$(target_os))),)
 endif
 
 # Mips Linux
-ifeq ($(strip $(filter-out mips linux%,$(target_cpu) $(target_os))),)
+ifeq ($(strip $(filter-out mips% linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads

[PATCH 1/2] [ADA] Fix MIPS big-endian build

2017-01-03 Thread James Cowgill
Hi,

This patch merges the mips and mipsel sections in
gcc-interface/Makefile.in favoring the existing variables in mipsel.
Over time, the mipsel target was tested much more than the mips target
and a number of fixes were applied which should have been applied to
both. Since the only real difference between mips and mipsel is the
endianness, it makes sense to merge them together and add an extra ifeq
for the one file which does differ with endianness.

I don't have commit access.

Thanks,
James

gcc/ada/Changelog:

2017-01-03  James Cowgill  <james.cowg...@imgtec.com>

* s-linux-mips.ads: Rename from s-linux-mipsel.ads.
* gcc-interface/Makefile.in (MIPS/Linux): Merge mips and mipsel
sections.

diff --git a/gcc/ada/gcc-interface/Makefile.in
b/gcc/ada/gcc-interface/Makefile.in
index 98889c0f30f..b47a16c8b41 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1813,36 +1813,12 @@ ifeq ($(strip $(filter-out cygwin% mingw32%
pe,$(target_os))),)
 endif
  # Mips Linux
-ifeq ($(strip $(filter-out mips linux%,$(target_cpu) $(target_os))),)
+ifeq ($(strip $(filter-out mips% linux%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads

Re: [PATCH] [PR rtl-optimization/65618] Fix MIPS ADA bootstrap failure

2017-01-03 Thread James Cowgill
On 01/01/17 22:27, Jeff Law wrote:
> On 12/20/2016 07:38 AM, James Cowgill wrote:
>> Hi,
>>
>> On 19/12/16 21:43, Jeff Law wrote:
>>> On 12/19/2016 08:44 AM, James Cowgill wrote:
>>>> 2016-12-16  James Cowgill  <james.cowg...@imgtec.com>
>>>>
>>>> PR rtl-optimization/65618
>>>> * emit-rtl.c (try_split): Update "after" when moving a
>>>> NOTE_INSN_CALL_ARG_LOCATION.
>>>>
>>>> diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
>>>> index 7de17454037..6be124ac038 100644
>>>> --- a/gcc/emit-rtl.c
>>>> +++ b/gcc/emit-rtl.c
>>>> @@ -3742,6 +3742,11 @@ try_split (rtx pat, rtx_insn *trial, int last)
>>>> next = NEXT_INSN (next))
>>>>  if (NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
>>>>{
>>>> +/* Advance after to the next instruction if it is about to
>>>> +   be removed.  */
>>>> +if (after == next)
>>>> +  after = NEXT_INSN (after);
>>>> +
>>>>  remove_insn (next);
>>>>  add_insn_after (next, insn, NULL);
>>>>  break;
>>>>
>>> So the thing I don't like when looking at this code is we set AFTER
>>> immediately upon entry to try_split.  But we don't use it until near the
>>> very end of try_split.  That's just asking for trouble.
>>>
>>> Can we reasonably initialize AFTER just before it's used?
>>
>> I wasn't sure but looking closer I think that would be fine. This patch
>> also works and does what Richard Sandiford suggested in the PR.
>>
>> 2016-12-20  James Cowgill  <james.cowg...@imgtec.com>
>>
>> PR rtl-optimization/65618
>> * emit-rtl.c (try_split): Move initialization of "before" and
>> "after" to just before the call to emit_insn_after_setloc.
> OK.

Great. Can you commit this for me, since I don't have commit access?

Thanks,
James


Re: [PATCH] [PR rtl-optimization/65618] Fix MIPS ADA bootstrap failure

2016-12-20 Thread James Cowgill
Hi,

On 19/12/16 21:43, Jeff Law wrote:
> On 12/19/2016 08:44 AM, James Cowgill wrote:
>> 2016-12-16  James Cowgill  <james.cowg...@imgtec.com>
>>
>> PR rtl-optimization/65618
>> * emit-rtl.c (try_split): Update "after" when moving a
>> NOTE_INSN_CALL_ARG_LOCATION.
>>
>> diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
>> index 7de17454037..6be124ac038 100644
>> --- a/gcc/emit-rtl.c
>> +++ b/gcc/emit-rtl.c
>> @@ -3742,6 +3742,11 @@ try_split (rtx pat, rtx_insn *trial, int last)
>> next = NEXT_INSN (next))
>>  if (NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
>>{
>> +/* Advance after to the next instruction if it is about to
>> +   be removed.  */
>> +if (after == next)
>> +  after = NEXT_INSN (after);
>> +
>>  remove_insn (next);
>>  add_insn_after (next, insn, NULL);
>>  break;
>>
> So the thing I don't like when looking at this code is we set AFTER
> immediately upon entry to try_split.  But we don't use it until near the
> very end of try_split.  That's just asking for trouble.
> 
> Can we reasonably initialize AFTER just before it's used?

I wasn't sure but looking closer I think that would be fine. This patch
also works and does what Richard Sandiford suggested in the PR.

2016-12-20  James Cowgill  <james.cowg...@imgtec.com>

PR rtl-optimization/65618
* emit-rtl.c (try_split): Move initialization of "before" and
"after" to just before the call to emit_insn_after_setloc.

diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 7de17454037..bdc984c65cf 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3643,8 +3643,7 @@ mark_label_nuses (rtx x)
 rtx_insn *
 try_split (rtx pat, rtx_insn *trial, int last)
 {
-  rtx_insn *before = PREV_INSN (trial);
-  rtx_insn *after = NEXT_INSN (trial);
+  rtx_insn *before, *after;
   rtx note;
   rtx_insn *seq, *tem;
   int probability;
@@ -3818,6 +3817,9 @@ try_split (rtx pat, rtx_insn *trial, int last)
}
 }
 
+  before = PREV_INSN (trial);
+  after = NEXT_INSN (trial);
+
   tem = emit_insn_after_setloc (seq, trial, INSN_LOCATION (trial));
 
   delete_insn (trial);

Thanks,
James


[PATCH] [PR rtl-optimization/65618] Fix MIPS ADA bootstrap failure

2016-12-19 Thread James Cowgill
Hi,

This patch fixes PR 65618 where ADA cannot be bootstrapped natively on
mips due to a bootstrap comparison failure. The PR is currently in the
target component, but should be in the rtl-optimization component.

The underlying bug is in gcc/emit-rtl.c:try_split and is a result of
the fix for PR rtl-optimization/48826. In that PR, if a call_insn is
split into two instructions, the following NOTE_INSN_CALL_ARG_LOCATION
is moved so that it immediately follows the new call_insn. However,
after doing that the "after" variable was not updated and it could
still point to the old note instruction (the instruction after the
instruction to be split). The "after" variable is later used to obtain
the last instruction in the split and is then passed back to the
delayed branch scheduler influencing how delay slots are assigned. My
patch adjusts the code which handles the NOTE_INSN_CALL_ARG_LOCATION
note so that "after" is updated if necessary.

This bug causes the ADA bootstrap comparison failure in a-except.o
because the branch delay scheduling operates slightly differently for
that file if debug information is turned on.

Thanks,
James

gcc/Changelog:

2016-12-16  James Cowgill  <james.cowg...@imgtec.com>

PR rtl-optimization/65618
* emit-rtl.c (try_split): Update "after" when moving a
NOTE_INSN_CALL_ARG_LOCATION.

diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 7de17454037..6be124ac038 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3742,6 +3742,11 @@ try_split (rtx pat, rtx_insn *trial, int last)
   next = NEXT_INSN (next))
if (NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
  {
+   /* Advance after to the next instruction if it is about to
+  be removed.  */
+   if (after == next)
+ after = NEXT_INSN (after);
+
remove_insn (next);
add_insn_after (next, insn, NULL);
break;