how to get TARGET_MEM_REF addr in gcc-7.3

2020-05-22 Thread 易会战 via Gcc
hi, I work on a tool that need to get address of some memory access on ssa 
form. I call build_fold_addr_expr function to get address.
I have finished it on gcc-9.3, and the tool can work correctly.
When I port it to gcc-7.3, the expand pass report a corrupt. I find it is 
TARGET_MEM_REF not properly work. It happened on expr.c:7880, a gcc_assert.
I check gcc-9.3 have a process for TARGET_MEM_REF, where (expr.c 7936)  
call the function addr_for_mem_ref.
So I do not know how to properly to get address for TARGET_MEM_REF?
Thanks for any advice!

Re: condition variables on vxworks

2020-05-22 Thread Olivier Hainque
Thanks Rasmus and Jonathan for your comments and suggestions.

> On 20 May 2020, at 12:07, Jonathan Wakely  wrote:
> 
> On Wed, 20 May 2020 at 09:44, Rasmus Villemoes  
> wrote:
>> 
>> Hi
>> 
>> The condition variable implementation added in commit 806dd0472f56fd
>> seems to fall into the trap(s) pointed out in the paper
>> 
>>  http://birrell.org/andrew/papers/ImplementingCVs.pdf
>> 
>> in particular, the "if no thread is currently waiting, signal should not
>> leave a full semaphore so a following _wait will just fall through".
>> 
>> Now, libgcc/gthr.h doesn't really spell out whether __gthread condition
>> variables are supposed to behave as POSIX condition variables, so I
>> don't know if it's a problem in practice.
> 
> The libstdc++ std::condition_variable assumes POSIX-ish semantics for
> __gthread_cond_t. It certainly assumes that a signal/broadcast will
> only wake threads that are currently waiting, not affect waits that
> haven't started yet. So it seems gthr-vxworks.h should not set
> __GTHREADS_CXX0X, or libstdc++ needs a different condition_variable
> implementation for VxWorks.
> 
> Libstdc++ also assumes this requirement of pthread_cond_destroy is met:
> "It shall be safe to destroy an initialized condition variable upon
> which no threads are currently blocked."
> This means it's OK for another thread to destroy the CV after the
> semTake (*cond, WAIT_FOREVER) statement in __ghtread_cond_wait, even
> if the semTake (*mutex, WAIT_FOREVER) statement hasn't happened. The
> code looks OK as far as that requirement goes.

> I'm not sure how many other implicit assumptions libstdc++ makes about
> POSIX-ish semantics.

Ok. The goal was to provide an implementation suitable for libstdc++
so we'll look into this further.

Thanks again for the pointers and insights on expectations!

> As an aside, it looks like there are enough libgcc/config/*vx* files
> to justify creating a libgcc/config/vxworks sub-directory.

Indeed. I'll add this to the list :)

Olivier



Re: ChangeLog files - server and client scripts

2020-05-22 Thread Richard Earnshaw
On 22/05/2020 05:57, Jakub Jelinek wrote:
> On Thu, May 21, 2020 at 03:12:21PM -0700, Ian Lance Taylor via Gcc wrote:
>> Hi, this unfortunately breaks gccgo development.  Significant parts of
>> the gccgo sources are simply copied from other repositories.  Those
>> other repositories do not use ChangeLog files.  The git commit hook
>> should not require ChangeLog files for those changes.  And, when the
>> time comes, no ChangeLog files should be created for changes in those
>> directories.
>>
>> The directories in question are
>>
>> gcc/go/gofrontend
>> libgo
>> gcc/testsuite/go.test/test
> 
> The script has:
> ignored_prefixes = [
> 'gcc/d/dmd/',
> 'gcc/go/frontend/',

The directory is gcc/go/gofrontend

so it's missing 'go' from frontend.

> 'libgo/',
> 'libphobos/libdruntime',
> 'libphobos/src/',
> 'libsanitizer/',
> ]
> so perhaps it just misses gcc/testsuite/go.test/test ?
> Or what exact files you've changed in your script?
> 
>   Jakub
> 

R.


Re: ChangeLog files - server and client scripts

2020-05-22 Thread Jakub Jelinek via Gcc
On Fri, May 22, 2020 at 12:04:10PM +0100, Richard Earnshaw wrote:
> >> The directories in question are
> >>
> >> gcc/go/gofrontend
> >> libgo
> >> gcc/testsuite/go.test/test
> > 
> > The script has:
> > ignored_prefixes = [
> > 'gcc/d/dmd/',
> > 'gcc/go/frontend/',
> 
> The directory is gcc/go/gofrontend
> 
> so it's missing 'go' from frontend.

Thanks for spotting.  I believe Martin said he will be afk
today, so I've fixed it for him and committed as obvious and
am going to install into git-hooks now too.

diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 7b61bb8915b..64a0db18e58 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-22  Jakub Jelinek  
+
+   * gcc-changelog/git_commit.py: Add trailing / to
+   gcc/testsuite/go.test/test and replace gcc/go/frontend/
+   with gcc/go/gofrontend/ in ignored locations.
+
 2020-05-22  Martin Liska  
 
* gcc-changelog/git_commit.py: Add gcc/testsuite/go.test/test
diff --git a/contrib/gcc-changelog/git_commit.py 
b/contrib/gcc-changelog/git_commit.py
index ba9f5ce9650..8c5fa2c0fc9 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -127,8 +127,8 @@ bug_components = set([
 
 ignored_prefixes = [
 'gcc/d/dmd/',
-'gcc/go/frontend/',
-'gcc/testsuite/go.test/test',
+'gcc/go/gofrontend/',
+'gcc/testsuite/go.test/test/',
 'libgo/',
 'libphobos/libdruntime',
 'libphobos/src/',

Jakub



Re: Writing automated tests for the GCC driver

2020-05-22 Thread Richard Biener via Gcc
On Thu, May 21, 2020 at 11:00 PM Giuliano Belinassi via Gcc
 wrote:
>
> Hi, all.
>
> GCC have a extensive testsuite, that is no news at all. However they are
> focused on the compiler (cc1*) or in libraries, and I can't find tests
> related to the GCC driver.
>
> Are there tests to the GCC driver? If yes, is there any docs about how
> to write them?

I think all tests to the driver eventually exercise a compiler in the end.
One obvious I can find is gcc.dg/driver-specs.c which tests
-specs=not-a-file properly diagnoses the missing file.

So the question back would be what kind of "driver" tests do you have?
That is, what makes them not, for example, "C compiler driven by driver" tests?

Thanks,
Richard.

> Thank you,
> Giuliano.


Re: New mklog script

2020-05-22 Thread Martin Sebor via Gcc

On 5/21/20 2:16 AM, Martin Liška wrote:

Hello Martin.

Can you please compare the current mklog.py. Is there anything
you miss compared to your current script?


Nope, it matches the format I get with my script and even works
better and runs faster.  Very nice!  I'll be happy to switch to
using it instead.

Thanks!
Martin

PS A couple of ideas for future enhancements are to have the script
print "New function." or "New type." for newly added functions and
types, and to print "Adjust comments." for changes to comments alone.


Re: New mklog script

2020-05-22 Thread Thomas Koenig via Gcc

Hi,

what's currently in trunk (as of a few hours ago) fails for me with

  File "contrib/mklog.py", line 36, in 
from unidiff import PatchSet
ModuleNotFoundError: No module named 'unidiff'

I think this is an error which would have to be taken into account
one way or another - maybe include it in download_prerequisites ?

Regards

Thomas


Re: New mklog script

2020-05-22 Thread Jonathan Wakely via Gcc
On Fri, 22 May 2020 at 19:15, Thomas Koenig via Gcc  wrote:
>
> Hi,
>
> what's currently in trunk (as of a few hours ago) fails for me with
>
>File "contrib/mklog.py", line 36, in 
>  from unidiff import PatchSet
> ModuleNotFoundError: No module named 'unidiff'
>
> I think this is an error which would have to be taken into account
> one way or another - maybe include it in download_prerequisites ?

No, most people do not want download_prerequisites to start installing
python packages, they should use their system's package manager.


>
> Regards
>
> Thomas


Re: ChangeLog files - server and client scripts

2020-05-22 Thread Ian Lance Taylor via Gcc
On Fri, May 22, 2020 at 4:11 AM Jakub Jelinek  wrote:
>
> On Fri, May 22, 2020 at 12:04:10PM +0100, Richard Earnshaw wrote:
> > >> The directories in question are
> > >>
> > >> gcc/go/gofrontend
> > >> libgo
> > >> gcc/testsuite/go.test/test
> > >
> > > The script has:
> > > ignored_prefixes = [
> > > 'gcc/d/dmd/',
> > > 'gcc/go/frontend/',
> >
> > The directory is gcc/go/gofrontend
> >
> > so it's missing 'go' from frontend.
>
> Thanks for spotting.  I believe Martin said he will be afk
> today, so I've fixed it for him and committed as obvious and
> am going to install into git-hooks now too.
>
> diff --git a/contrib/ChangeLog b/contrib/ChangeLog
> index 7b61bb8915b..64a0db18e58 100644
> --- a/contrib/ChangeLog
> +++ b/contrib/ChangeLog
> @@ -1,3 +1,9 @@
> +2020-05-22  Jakub Jelinek  
> +
> +   * gcc-changelog/git_commit.py: Add trailing / to
> +   gcc/testsuite/go.test/test and replace gcc/go/frontend/
> +   with gcc/go/gofrontend/ in ignored locations.
> +
>  2020-05-22  Martin Liska  
>
> * gcc-changelog/git_commit.py: Add gcc/testsuite/go.test/test
> diff --git a/contrib/gcc-changelog/git_commit.py 
> b/contrib/gcc-changelog/git_commit.py
> index ba9f5ce9650..8c5fa2c0fc9 100755
> --- a/contrib/gcc-changelog/git_commit.py
> +++ b/contrib/gcc-changelog/git_commit.py
> @@ -127,8 +127,8 @@ bug_components = set([
>
>  ignored_prefixes = [
>  'gcc/d/dmd/',
> -'gcc/go/frontend/',
> -'gcc/testsuite/go.test/test',
> +'gcc/go/gofrontend/',
> +'gcc/testsuite/go.test/test/',
>  'libgo/',
>  'libphobos/libdruntime',
>  'libphobos/src/',

Thanks for looking into this.

Unfortunately, my push is still failing.  I'm not sure why.

remote: *** ChangeLog format failed:
remote: ERR: cannot find a ChangeLog location in message
remote:
remote: Please see: https://gcc.gnu.org/codingconventions.html#ChangeLogs
remote:
remote: error: hook declined to update refs/heads/master
To git+ssh://gcc.gnu.org/git/gcc
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'git+ssh://gcc.gnu.org/git/gcc'


I've attached the output of "git format-patch -k 1 --stdout", in case
that helps.

Ian
From 81994eab700da7fea6644541c163aa0f0f3b8cf1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= 
Date: Tue, 19 May 2020 16:03:54 +0200
Subject: libgo: update x/sys/cpu after gccgo support added

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/234597
---
 gcc/go/gofrontend/MERGE   |  2 +-
 .../sys/cpu/{cpu_aix_ppc64.go => cpu_aix.go}  |  2 +-
 .../golang.org/x/sys/cpu/syscall_aix_gccgo.go | 27 +++
 3 files changed, 29 insertions(+), 2 deletions(-)
 rename libgo/go/golang.org/x/sys/cpu/{cpu_aix_ppc64.go => cpu_aix.go} (96%)
 create mode 100644 libgo/go/golang.org/x/sys/cpu/syscall_aix_gccgo.go

diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index bc9c1f07eda..284374820b0 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-bc27341f245a5cc54ac7530d037a609db72b677c
+ea58b8491064fbed18a220571a3043c38dccf7c7
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go 
b/libgo/go/golang.org/x/sys/cpu/cpu_aix.go
similarity index 96%
rename from libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go
rename to libgo/go/golang.org/x/sys/cpu/cpu_aix.go
index b0ede112d4e..02d03129e50 100644
--- a/libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go
+++ b/libgo/go/golang.org/x/sys/cpu/cpu_aix.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build aix,ppc64
+// +build aix
 
 package cpu
 
diff --git a/libgo/go/golang.org/x/sys/cpu/syscall_aix_gccgo.go 
b/libgo/go/golang.org/x/sys/cpu/syscall_aix_gccgo.go
new file mode 100644
index 000..2609cc49ae7
--- /dev/null
+++ b/libgo/go/golang.org/x/sys/cpu/syscall_aix_gccgo.go
@@ -0,0 +1,27 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Recreate a getsystemcfg syscall handler instead of
+// using the one provided by x/sys/unix to avoid having
+// the dependency between them. (See golang.org/issue/32102)
+// Morover, this file will be used during the building of
+// gccgo's libgo and thus must not use a CGo method.
+
+// +build aix
+// +build gccgo
+
+package cpu
+
+import (
+   "syscall"
+)
+
+//extern getsystemcfg
+func gccgoGetsystemcfg(label uint32) (r uint64)
+
+func callgetsystemcfg(label int) (r1 uintptr, e1 syscall.Errno) {
+   r1 = uintptr(gccgoGetsystemcfg(uint32(label)))
+   e1 = syscall.GetErrno()
+   return
+}
-- 
2.27.0.rc0.183.gde8f92d652-goog



Re: ChangeLog files - server and client scripts

2020-05-22 Thread Jakub Jelinek via Gcc
On Fri, May 22, 2020 at 12:37:29PM -0700, Ian Lance Taylor wrote:
> Thanks for looking into this.
> 
> Unfortunately, my push is still failing.  I'm not sure why.
> 
> remote: *** ChangeLog format failed:
> remote: ERR: cannot find a ChangeLog location in message
> remote:
> remote: Please see: https://gcc.gnu.org/codingconventions.html#ChangeLogs
> remote:
> remote: error: hook declined to update refs/heads/master
> To git+ssh://gcc.gnu.org/git/gcc
>  ! [remote rejected] master -> master (hook declined)
> error: failed to push some refs to 'git+ssh://gcc.gnu.org/git/gcc'
> 
> 
> I've attached the output of "git format-patch -k 1 --stdout", in case
> that helps.

Bet the script first looks for the ChangeLog entry and only considers the
ignored prefixes if it finds files in the patch that are not mentioned in
the ChangeLog entry.  So, if you say modified gcc/go/whatever.cc and had
ChangeLog entry for that and not for the files you've changed, it would be
ok.

So, I think before emitting the above message, it should look through the
patch and if it finds all files in ignored prefixes, it should just not to
do anything.

We'll need it e.g. for the DATESTAMP bump job too which only modifies those
files too and doesn't write ChangeLog entry for that.

I'm sorry but I don't know the script well enough to fix it quickly, will
defer to Martin as the author.

Can you wait with the commit until Monday?  If not, I could just temporarily
disable this for your commit.

Jakub



Re: New mklog script

2020-05-22 Thread Jason Merrill via Gcc
On Thu, May 21, 2020 at 6:03 PM Jason Merrill  wrote:
>
> On Fri, May 15, 2020 at 11:39 AM Martin Liška  wrote:
> >
> > On 5/15/20 3:22 PM, Marek Polacek wrote:
> > > On Fri, May 15, 2020 at 03:12:27PM +0200, Martin Liška wrote:
> > >> On 5/15/20 2:42 PM, Marek Polacek wrote:
> > >>> I actually use mklog -i all the time.  But I can work around it if it
> > >>> disappears.
> > >>
> > >> Ah, I can see a consumer.
> > >> There's an updated version that supports that.
> > >>
> > >> For the future, will you still use the option? Wouldn't be better
> > >> to put the ChangeLog content directly to commit message? Note
> > >> that you won't have to copy the entries to a particular ChangeLog file.
> > >
> > > The way I do it is to generate a patch using format-patch, use mklog -i
> > > on it, then add the ChangeLog entry to the commit message via commit 
> > > --amend.
> >
> > Hmm, you can do much better with:
> >
> > $ git diff | ./contrib/mklog > changelog && git commit -a -t changelog
> >
> > Or for an already created commit you can do:
> >
> > $ git diff HEAD~ | ./contrib/mklog > changelog && git commit -a --amend -e 
> > -F changelog
>
> With these git aliases:
>
> mklog-editor = "!f() { git show | git gcc-mklog >> $1; }; f"
> addlog = "!f() { GIT_EDITOR='git mklog-editor' git commit --amend; }; 
> f"
>
> I can 'git addlog' to append the output of mklog to the current
> commit.  Probably better would be to do something with
> prepare-commit-msg.

This is pretty rudimentary, but good enough as a start:

#!/bin/sh

#COMMIT_MSG_FILE=$1
#COMMIT_SOURCE=$2
#SHA1=$3

if ! [ -f "$1" ]; then exit 0; fi

#echo "# $0 $1 $2 $3" >> $1

if fgrep 'ChangeLog:' $1 > /dev/null 2>&1; then exit 0; fi

if [ -z "$2" ]; then
cmd="diff --cached"
elif [ $2 == commit ]; then
cmd="show $3"
else
exit 0
fi

git $cmd | git gcc-mklog >> $1



Re: ChangeLog files - server and client scripts

2020-05-22 Thread Ian Lance Taylor via Gcc
On Fri, May 22, 2020 at 12:48 PM Jakub Jelinek  wrote:
>
> On Fri, May 22, 2020 at 12:37:29PM -0700, Ian Lance Taylor wrote:
> > Thanks for looking into this.
> >
> > Unfortunately, my push is still failing.  I'm not sure why.
> >
> > remote: *** ChangeLog format failed:
> > remote: ERR: cannot find a ChangeLog location in message
> > remote:
> > remote: Please see: https://gcc.gnu.org/codingconventions.html#ChangeLogs
> > remote:
> > remote: error: hook declined to update refs/heads/master
> > To git+ssh://gcc.gnu.org/git/gcc
> >  ! [remote rejected] master -> master (hook declined)
> > error: failed to push some refs to 'git+ssh://gcc.gnu.org/git/gcc'
> >
> >
> > I've attached the output of "git format-patch -k 1 --stdout", in case
> > that helps.
>
> Bet the script first looks for the ChangeLog entry and only considers the
> ignored prefixes if it finds files in the patch that are not mentioned in
> the ChangeLog entry.  So, if you say modified gcc/go/whatever.cc and had
> ChangeLog entry for that and not for the files you've changed, it would be
> ok.
>
> So, I think before emitting the above message, it should look through the
> patch and if it finds all files in ignored prefixes, it should just not to
> do anything.
>
> We'll need it e.g. for the DATESTAMP bump job too which only modifies those
> files too and doesn't write ChangeLog entry for that.
>
> I'm sorry but I don't know the script well enough to fix it quickly, will
> defer to Martin as the author.
>
> Can you wait with the commit until Monday?  If not, I could just temporarily
> disable this for your commit.

Sure, I can wait.  Thanks for looking at it.

Ian


gcc-9-20200522 is now available

2020-05-22 Thread GCC Administrator via Gcc
Snapshot gcc-9-20200522 is now available on
  https://gcc.gnu.org/pub/gcc/snapshots/9-20200522/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 9 git branch
with the following options: git://gcc.gnu.org/git/gcc.git branch releases/gcc-9 
revision f1d34396c264ae15ba7492bd2b800c5764d92134

You'll find:

 gcc-9-20200522.tar.xzComplete GCC

  SHA256=d003d773d5c016497bda531ae4548f45bf5cd823f4381e1dd0dd21f4d94a6bbe
  SHA1=1f0780fe08633ebca1c8eeacb8cd393c555be55e

Diffs from 9-20200515 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-9
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.