Re: [patch, fortran] ICE in attr_decl1, at fortran/decl.c:8691

2022-12-27 Thread Harald Anlauf via Fortran

Hi Jerry,

Am 26.12.22 um 23:26 schrieb Jerry DeLisle via Gcc-patches:

The attached patch was provided by Steve Kargl.  After exploring for
possible other checks I settled on leaving the patch intact.

Two existing test cases updated as different but sensible error messages
resulted.


I think this is fine.  The error message for CLASS is
now arguably more consistent with TYPE.


Regression tested on main line.

OK to commit?


Regarding the format of the commit message: if you want
bugzilla to get updated properly, please consider adding
PR/fortran ## to the respective parts below.
It is also custom to have a one-line summary including
e.g. [PR##] to make it easier for others to relate
a commit to bugzilla.

OK with these things fixed.

Thanks for taking this!

Harald


Regards,

Jerry

Author: Steve Kargl 
Date:   Mon Dec 26 14:07:04 2022 -0800

  Modify checks to avoid referencing NULL pointer.
  Update test cases with error messages that changed as a result.

  gcc/fortran/ChangeLog:

  * decl.cc (attr_decl1): Guard against NULL pointer.
  * parse.cc (match_deferred_characteristics): Include
BT_CLASS in check for
derived being undefined.

  gcc/testsuite/ChangeLog:

  * gfortran.dg/class_result_4.f90: Update error message check.
  * gfortran.dg/pr85779_3.f90: Update error message check.




Re: [PATCH] libgfortran: Replace mutex with rwlock

2022-12-27 Thread H.J. Lu via Fortran
On Sun, Dec 25, 2022 at 4:58 PM Steve Kargl via Gcc-patches
 wrote:
>
> On Wed, Dec 21, 2022 at 07:27:11PM -0500, Lipeng Zhu via Fortran wrote:
> > This patch try to introduce the rwlock and split the read/write to
> > unit_root tree and unit_cache with rwlock instead of the mutex to
> > increase CPU efficiency. In the get_gfc_unit function, the percentage
> > to step into the insert_unit function is around 30%, in most instances,
> > we can get the unit in the phase of reading the unit_cache or unit_root
> > tree. So split the read/write phase by rwlock would be an approach to
> > make it more parallel.
> >
> > BTW, the IPC metrics can increase from 0.25 to 2.2 in the Intel
> > SRP server with 220 cores. The benchmark we used is
> > https://github.com/rwesson/NEAT
> >
>
> The patch fails bootstrap on x86_64-*-freebsd.
>
> gmake[6]: Entering directory 
> '/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/src/c++17'
> /bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile 
> /home/kargl/gcc/obj/./gcc/xgcc -shared-libgcc -B/home/kargl/gcc/obj/./gcc 
> -nostdinc++ -L/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/src 
> -L/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/src/.libs 
> -L/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/libsupc++/.libs 
> -B/home/kargl/work/x86_64-unknown-freebsd14.0/bin/ 
> -B/home/kargl/work/x86_64-unknown-freebsd14.0/lib/ -isystem 
> /home/kargl/work/x86_64-unknown-freebsd14.0/include -isystem 
> /home/kargl/work/x86_64-unknown-freebsd14.0/sys-include   -fno-checking 
> -I/home/kargl/gcc/gcc/libstdc++-v3/../libgcc 
> -I/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/x86_64-unknown-freebsd14.0
>  -I/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include 
> -I/home/kargl/gcc/gcc/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++ 
> -prefer-pic -D_GLIBCXX_SHARED -fno-implicit-templates  -Wall -Wextra 
> -Wwrite-strings -Wcast-qual -Wabi=2  -fdiagnostics-show-location=once   
> -ffunction-sections -fdata-sections  -frandom-seed=floating_from_chars.lo  
> -fimplicit-templates -g -O2  -c -o floating_from_chars.lo 
> ../../../../../gcc/libstdc++-v3/src/c++17/floating_from_chars.cc
> libtool: compile:  /home/kargl/gcc/obj/./gcc/xgcc -shared-libgcc 
> -B/home/kargl/gcc/obj/./gcc -nostdinc++ 
> -L/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/src 
> -L/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/src/.libs 
> -L/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/libsupc++/.libs 
> -B/home/kargl/work/x86_64-unknown-freebsd14.0/bin/ 
> -B/home/kargl/work/x86_64-unknown-freebsd14.0/lib/ -isystem 
> /home/kargl/work/x86_64-unknown-freebsd14.0/include -isystem 
> /home/kargl/work/x86_64-unknown-freebsd14.0/sys-include -fno-checking 
> -I/home/kargl/gcc/gcc/libstdc++-v3/../libgcc 
> -I/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/x86_64-unknown-freebsd14.0
>  -I/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include 
> -I/home/kargl/gcc/gcc/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++ 
> -D_GLIBCXX_SHARED -fno-implicit-templates -Wall -Wextra -Wwrite-strings 
> -Wcast-qual -Wabi=2 -fdiagnostics-show-location=once -ffunction-sections 
> -fdata-sections -frandom-seed=floating_from_chars.lo -fimplicit-templates -g 
> -O2 -c ../../../../../gcc/libstdc++-v3/src/c++17/floating_from_chars.cc  
> -fPIC -DPIC -D_GLIBCXX_SHARED -o floating_from_chars.o
> In file included from 
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/memory_resource:40,
>  from 
> ../../../../../gcc/libstdc++-v3/src/c++17/floating_from_chars.cc:37:
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:
>  In function 'int std::__glibcxx_rwlock_rdlock(pthread_rwlock**)':
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:80:3:
>  error: call of overloaded '__gthrw_pthread_rwlock_rdlock(pthread_rwlock**&)' 
> is ambiguous
>80 |   _GLIBCXX_GTHRW(rwlock_rdlock)
>   |   ^
> In file included from 
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/x86_64-unknown-freebsd14.0/bits/gthr.h:148,
>  from 
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/bits/std_mutex.h:41,
>  from 
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:41:
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:80:3:
>  note: candidate: 'int std::__gthrw_pthread_rwlock_rdlock(pthread_rwlock**)'
>80 |   _GLIBCXX_GTHRW(rwlock_rdlock)
>   |   ^~
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/x86_64-unknown-freebsd14.0/bits/gthr-default.h:140:1:
>  note: candidate: 'int __gthrw_pthread_rwlock_rdlock(pthread_rwlock**)'
>   140 | __gthrw(pthread_rwlock_rdlock)
>   | ^~~
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libst