[Bug libgcc/67792] GCC 5.2 - make clean fails in libgcc

2020-08-21 Thread akruppa at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67792

Alex Kruppa  changed:

   What|Removed |Added

 CC||akruppa at gmail dot com

--- Comment #4 from Alex Kruppa  ---
Problem still exists in 10.2.0:

true "AR_FLAGS=" "CC_FOR_BUILD=" "CC_FOR_TARGET=" "CFLAGS=" "CXXFLAGS="
"CFLAGS_FOR_BUILD=" "CFLAGS_FOR_TARGET=" "INSTALL=/usr/bin/install -c"
"INSTALL_DATA=/usr/bin/install -c -m 644" "INSTALL_PROGRAM=/usr/bin/install -c"
"INSTALL_SCRIPT=/usr/bin/install -c" "LDFLAGS=" "LIBCFLAGS="
"LIBCFLAGS_FOR_TARGET=" "MAKE=make" "MAKEINFO=makeinfo --split-size=500
--split-size=500 " "SHELL=/bin/sh" "RUNTESTFLAGS="
"exec_prefix=/opt/gcc-10.2.0" "infodir=/opt/gcc-10.2.0/share/info"
"libdir=/opt/gcc-10.2.0/lib64" "includedir=/opt/gcc-10.2.0/include"
"prefix=/opt/gcc-10.2.0" "tooldir="
"gxx_include_dir=/opt/gcc-10.2.0/include/c++/10.2.0" "AR=" "AS=/./gcc/as"
"LD=/./gcc/collect-ld" "RANLIB=" "NM=/./gcc/nm" "NM_FOR_BUILD="
"NM_FOR_TARGET=" "DESTDIR=" "WERROR=" DO=mostlyclean multi-clean # make
make[5]: Leaving directory
'/home/alex/build/gcc-10.2.0/x86_64-pc-linux-gnu/32/libstdc++-v3'
make[4]: Leaving directory
'/home/alex/build/gcc-10.2.0/x86_64-pc-linux-gnu/32/libstdc++-v3'
make[3]: Leaving directory
'/home/alex/build/gcc-10.2.0/x86_64-pc-linux-gnu/libstdc++-v3'
make[2]: Leaving directory
'/home/alex/build/gcc-10.2.0/x86_64-pc-linux-gnu/libstdc++-v3'
make[1]: Leaving directory
'/home/alex/build/gcc-10.2.0/x86_64-pc-linux-gnu/libstdc++-v3'
make[1]: Entering directory
'/home/alex/build/gcc-10.2.0/x86_64-pc-linux-gnu/libgcc'
make[1]: -B/opt/gcc-10.2.0/x86_64-pc-linux-gnu/bin/: Command not found
make[1]: -B/opt/gcc-10.2.0/x86_64-pc-linux-gnu/bin/: Command not found
/bin/sh: line 0: test: !=: unary operator expected
rm -f libgcc_tm.h libgcc.map
Makefile:187: *** Recursive variable 'AR_FOR_TARGET' references itself
(eventually).  Stop.
make[1]: Leaving directory
'/home/alex/build/gcc-10.2.0/x86_64-pc-linux-gnu/libgcc'
make: *** [Makefile:19194: clean-stage1-target-libgcc] Error 2

[Bug tree-optimization/60641] New: Converting ushort to offset on x86_64 generates double movzwl

2014-03-24 Thread akruppa at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60641

Bug ID: 60641
   Summary: Converting ushort to offset on x86_64 generates double
movzwl
   Product: gcc
   Version: 4.7.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: akruppa at gmail dot com

The following test cases produce sub-optimal assembly output.
This was verified with these three versions of gcc:
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
gcc (SUSE Linux) 4.7.3
gcc (Debian 4.8.2-16) 4.8.2


#include 
unsigned short
foo (const unsigned short *start, const unsigned char *mask)
{
   unsigned short r = 0;
   unsigned short ux = *start;
   if (mask[ux])
 r = ux;
   return r;
}
void bar(unsigned int *s, unsigned short a)
{
  s[a] = a;
}


Compile with, e.g., 

gcc -std=c99 -g -W -Wall -O3 -c movzwl.c

The effect also occurs when using -O2 instead.

The foo() function contains:
   0x <+0>: movzwl (%rdi),%edx
   0x0003 <+3>: xor%eax,%eax
   0x0005 <+5>: movzwl %dx,%ecx
   0x0008 <+8>: cmpb   $0x0,(%rsi,%rcx,1)


The foo() function is:
   0x0010 <+0>: movzwl %si,%eax
   0x0013 <+3>: movzwl %si,%esi
   0x0016 <+6>: mov%esi,(%rdi,%rax,4)
   0x0019 <+9>: retq   


In both cases, an unnecessary movzwl instruction is generated. This may be the
same issue as #36873, which was rejected because the test cases used volatile
accesses. These test cases here show that the duplicate movzwl occurs without
volatile as well.


[Bug tree-optimization/61277] New: Incorrect -Warray-bounds warning with 4.9.0

2014-05-21 Thread akruppa at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61277

Bug ID: 61277
   Summary: Incorrect -Warray-bounds warning with 4.9.0
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: akruppa at gmail dot com

The following code, when compiled with the gcc 4.9.0 release or with SVN branch
gcc-4_9-branch r210719, via

gcc -O2 -Wall -c bug.c

produces the warning

bug.c: In function ‘foo’:
bug.c:13:8: warning: array subscript is below array bounds [-Warray-bounds]
   if (s[n-1] != 2)
^

If foo() returns 2, the array accesses are not out of bounds.

Gcc 4.8.1 does not produce the warning. 
The gcc 4.9.0 and SVN builds were configured with

configure --prefix=install/dir/ --enable-languages=c,c++


int foo();
int s[2];
int bar()
{
  int n = foo();
  int i;

  for(i = 0 ; i < n ; i++)
if ((i == 0) != (s[i] == 0))
  return 0;
  if (s[n-1] != 2)
  return 0;   
  for(i = 0 ; i < n ; i++)
  if (s[0])
return 0;
  return 1;
}

[Bug target/60641] Converting ushort to offset on x86_64 generates double movzwl

2014-05-26 Thread akruppa at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60641

--- Comment #2 from Alex Kruppa  ---
With gcc-4.9.0, compiled from the official tarball, the foo() function does NOT
produce the double movzwl instruction any more, but the bar() function still
does.

Dump of assembler code for function foo:
   0x <+0>:movzwl (%rdi),%edx
   0x0003 <+3>:cmpb   $0x0,(%rsi,%rdx,1)
   0x0007 <+7>:mov%rdx,%rax
   0x000a <+10>:mov$0x0,%edx
   0x000f <+15>:cmove  %edx,%eax
   0x0012 <+18>:retq   

Dump of assembler code for function bar:
   0x0020 <+0>:movzwl %si,%eax
   0x0023 <+3>:movzwl %si,%esi
   0x0026 <+6>:mov%esi,(%rdi,%rax,4)
   0x0029 <+9>:retq