[Bug c++/59383] New: typedef propagation with template base class using the same name is wrong

2013-12-04 Thread gmarkhor at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59383

Bug ID: 59383
   Summary: typedef propagation with template base class using the
same name is wrong
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gmarkhor at gmail dot com

I am using g++ 4.8.1. Consider the following code (compiled as g++ -std=c++11
-c test.cc):

#include 

template 
struct TypePair {
  typedef F First;
  typedef S Second;
};

template 
class Base {
 public:
  typedef TypePair Family;
  typedef Base ParentType;
};

template 
class Derived : public Base {
 public:
  typedef TypePair Family;
  typedef typename Family::Second ParentType;
};

static_assert(std::is_same, Derived<1>::ParentType>::value, "Error");




The static assertion is failed. Clang ver. 3.2 and 3.3 and 3.4 compiles this
code well.

If you remove the template from Base:




#include 

template 
struct TypePair {
  typedef F First;
  typedef S Second;
};

class Base {
 public:
  typedef TypePair Family;
  typedef Base ParentType;
};

template 
class Derived : public Base {
 public:
  typedef TypePair Family;
  typedef typename Family::Second ParentType;
};

static_assert(std::is_same::ParentType>::value, "Error");




then everything becomes OK. The other way to make it work is to remove template
from Derived and inherit from an explicit Base<1>:





#include 

template 
struct TypePair {
  typedef F First;
  typedef S Second;
};

template 
class Base {
 public:
  typedef TypePair Family;
  typedef Base ParentType;
};

class Derived : public Base<1> {
 public:
  typedef TypePair Family;
  typedef typename Family::Second ParentType;
};

static_assert(std::is_same, Derived::ParentType>::value, "Error");



I am not sure what standard says about this, but it seems a bug.


[Bug c/67254] New: On-stack memory regions with aligned attribute overlap on ARM

2015-08-18 Thread gmarkhor at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67254

Bug ID: 67254
   Summary: On-stack memory regions with aligned attribute overlap
on ARM
   Product: gcc
   Version: 5.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gmarkhor at gmail dot com
  Target Milestone: ---

Consider the following program:

#include 
#include 

int main() {
  uint16_t data[] __attribute__ ((aligned (32))) = {
  12288, 16777, 18103, 49820, 17421, 18573, 18420, 49771, 24528,
  12288, 12288, 12288, 12288, 64512, 31744, 32256, 2, 32785, 168,
  32768, 0, 0, 0, 0, 0, 0, 32768, 0, 0, 0, 0, 0, 0, 12288 };
  float reference[] __attribute__ ((aligned (32))) = {
  0.125, 2.76757812, 6.71484375, -3.3046875, 4.05078125, 9.1015625,
  7.953125, -3.20898438, 500.066406, 0.125, 0.125, 0.125, 0.125,
  -0, 0, 0, 0.001, -0.01,
  0.1, -0, 0, 0, 0, 0, 0, 0, -0, 0, 0, 0, 0, 0, 0, 0.125 };
  int data_length = sizeof(data) / sizeof(data[0]);
  printf("data: %p <-> %p\n", &data[0], &data[data_length - 1]);
  printf("reference: %p <-> %p\n", &reference[0], &reference[sizeof(reference)
/ sizeof(reference[0]) - 1]);
  if ((void*)(data + data_length - 1) >= (void*)(&reference[0])) {
printf("overlap!\n");
  }
  return 0;
}

I compile it and run on armv7 development board. It prints something like

data: 0xbea7f500 <-> 0xbea7f542
reference: 0xbea7f460 <-> 0xbea7f4e4
overlap!

In other words, memory allocated for data and reference overlap.

I checked it on gcc 4.8.2 and gcc 5.1.0. It works as expected on x86_64.


[Bug lto/48725] New: 4.6.0 fails to link p7zip 9.20.1 with LTO and gold

2011-04-22 Thread gmarkhor at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48725

   Summary: 4.6.0 fails to link p7zip 9.20.1 with LTO and gold
   Product: gcc
   Version: 4.6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: lto
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: gmark...@gmail.com


My GCC version is 4.6.0 release, working under Ubuntu 10.10 x64.
gcc -###
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/.../x86_64-gcc-4.6.0/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/.../x86_64-gcc-4.6.0 --enable-shared
--with-arch=native --enable-languages=c,c++ --enable-lto --enable-plugin
--enable-gold --enable-linker-build-id --disable-multilib --enable-ld=default
--with-plugin-ld=ld.gold
Thread model: posix
gcc version 4.6.0 (GCC)

It uses binutils 2.21.51, installed at the same prefix "/.../x86_64-gcc-4.6.0".
ld.gold --version
GNU gold (GNU Binutils 2.21.51.20110414) 1.11
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

I make p7zip 9.20.1, downloadable at p7zip.sourceforge.net. I use makefile
named makefile.linux_amd64 with the following addition:

OPTFLAGS=-O2 -flto

When it comes to linking 7z.so, I get the following:
...

make[1]: Entering directory `/???/p7zip_9.20.1/CPP/7zip/Bundles/Format7zFree'
g++ -m64 -O2 -flto -pipe -s -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG
-D_REENTRANT -DENV_UNIX -D_7ZIP_LARGE_PAGES -fPIC -DEXTERNAL_CODECS -DUNICODE
-D_UNICODE -fPIC -shared -o ../../../../bin/7z.so  wine_date_and_time.o
myGetTickCount.o CRC.o IntToString.o MyMap.o MyString.o MyWindows.o MyXml.o
StringConvert.o StringToInt.o MyVector.o UTFConvert.o Wildcard.o  FileDir.o
FileFind.o FileIO.o PropVariant.o PropVariantUtils.o Synchronization.o System.o
Time.o  InBuffer.o InOutTempBuffer.o CreateCoder.o CWrappers.o FilterCoder.o
LimitedStreams.o LockedStream.o MethodId.o MethodProps.o MemBlocks.o
OffsetStream.o OutBuffer.o OutMemStream.o ProgressMt.o ProgressUtils.o
StreamBinder.o StreamObjects.o StreamUtils.o VirtThread.o  ArchiveExports.o
DllExports2.o ApmHandler.o ArjHandler.o Bz2Handler.o CpioHandler.o
CramfsHandler.o DebHandler.o DeflateProps.o DmgHandler.o ElfHandler.o
FatHandler.o FlvHandler.o GzHandler.o LzhHandler.o LzmaHandler.o MachoHandler.o
MbrHandler.o MslzHandler.o MubHandler.o NtfsHandler.o PeHandler.o PpmdHandler.o
RpmHandler.o SplitHandler.o SwfHandler.o SquashfsHandler.o VhdHandler.o
XarHandler.o XzHandler.o ZHandler.o  CoderMixer2.o CoderMixer2MT.o
CrossThreadProgress.o DummyOutStream.o FindSignature.o InStreamWithCRC.o
ItemNameUtils.o MultiStream.o OutStreamWithCRC.o OutStreamWithSha1.o
HandlerOut.o ParseProperties.o  7zCompressionMode.o 7zDecode.o 7zEncode.o
7zExtract.o 7zFolderInStream.o 7zFolderOutStream.o 7zHandler.o 7zHandlerOut.o
7zHeader.o 7zIn.o 7zOut.o 7zProperties.o 7zSpecStream.o 7zUpdate.o 7zRegister.o
 CabBlockInStream.o CabHandler.o CabHeader.o CabIn.o CabRegister.o 
ChmHandler.o ChmHeader.o ChmIn.o ChmRegister.o  ComHandler.o ComIn.o
ComRegister.o  HfsHandler.o HfsIn.o HfsRegister.o  IsoHandler.o IsoHeader.o
IsoIn.o IsoRegister.o  NsisDecode.o NsisHandler.o NsisIn.o NsisRegister.o 
RarHandler.o RarHeader.o RarIn.o RarItem.o RarVolumeInStream.o RarRegister.o 
TarHandler.o TarHandlerOut.o TarHeader.o TarIn.o TarOut.o TarUpdate.o
TarRegister.o  UdfHandler.o UdfIn.o UdfRegister.o  WimHandler.o WimHandlerOut.o
WimIn.o WimRegister.o  ZipAddCommon.o ZipHandler.o ZipHandlerOut.o ZipHeader.o
ZipIn.o ZipItem.o ZipOut.o ZipUpdate.o ZipRegister.o  CodecExports.o
ArjDecoder1.o ArjDecoder2.o Bcj2Coder.o Bcj2Register.o BcjCoder.o BcjRegister.o
BitlDecoder.o BranchCoder.o BranchMisc.o BranchRegister.o ByteSwap.o BZip2Crc.o
BZip2Decoder.o BZip2Encoder.o BZip2Register.o CopyCoder.o CopyRegister.o
Deflate64Register.o DeflateDecoder.o DeflateEncoder.o DeflateRegister.o
DeltaFilter.o Lzma2Decoder.o Lzma2Encoder.o Lzma2Register.o ImplodeDecoder.o
ImplodeHuffmanDecoder.o LzhDecoder.o LzmaDecoder.o LzmaEncoder.o LzmaRegister.o
LzOutWindow.o Lzx86Converter.o LzxDecoder.o PpmdDecoder.o PpmdEncoder.o
PpmdRegister.o PpmdZip.o QuantumDecoder.o ShrinkDecoder.o ZlibDecoder.o
ZlibEncoder.o ZDecoder.o  7zAes.o 7zAesRegister.o HmacSha1.o MyAes.o
Pbkdf2HmacSha1.o RandGen.o Rar20Crypto.o RarAes.o Sha1.o WzAes.o ZipCrypto.o
ZipStrong.o  7zBuf2.o 7zStream.o Aes.o Alloc.o Bra.o Bra86.o BraIA64.o
BwtSort.o Delta.o HuffEnc.o LzFind.o LzFindMt.o Lzma2Dec.o Lzma2Enc.o LzmaDec.o
LzmaEnc.o MtCoder.o Ppmd7.o Ppmd7Dec.o Ppmd7Enc.o Ppmd8.o Ppmd8Dec.o Ppmd8Enc.o
Sha256.o Sort.o Threads.o Xz.o XzCrc64.o XzDec.o XzEnc.o XzIn.o  7zCrc.o
7zCrcOpt.o  -lpthread -ldl
/.../x86_64-gcc-4.6.0/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin/ld.gold:
in

[Bug lto/48725] 4.6.0 fails to link p7zip 9.20.1 with LTO and gold

2011-04-22 Thread gmarkhor at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48725

--- Comment #2 from Vadim Markovtsev  2011-04-22 
13:12:17 UTC ---
> Can you, please, fill in binutils bug?

Done. The link to it is http://sourceware.org/bugzilla/show_bug.cgi?id=12695


[Bug lto/48725] 4.6.0 fails to link p7zip 9.20.1 with LTO and gold

2011-04-25 Thread gmarkhor at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48725

--- Comment #3 from Vadim Markovtsev  2011-04-25 
09:47:25 UTC ---
BTW, gold fails to link if used in a similar way in LLVM LTO, so it is likely
not a GCC bug.


[Bug lto/48725] 4.6.0 fails to link p7zip 9.20.1 with LTO and gold

2011-04-25 Thread gmarkhor at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48725

--- Comment #5 from Vadim Markovtsev  2011-04-25 
16:06:25 UTC ---
(In reply to comment #4)
> Does it work with BFD linker in CVS?

I will check that out tomorrow.


[Bug lto/48725] 4.6.0 fails to link p7zip 9.20.1 with LTO and gold

2011-05-10 Thread gmarkhor at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48725

--- Comment #6 from Vadim Markovtsev  2011-05-10 
11:01:14 UTC ---
(In reply to comment #5)
> (In reply to comment #4)
> > Does it work with BFD linker in CVS?
> 
> I will check that out tomorrow.

Sorry for such a delay,

I checked out binutils from CVS on May, 10. p7zip is built flawlessly with the
BFD linker. The gold linker (when building with LTO) fails the same way.


[Bug lto/48947] New: 4.6.0 fails to link ffmpeg with LTO and gold

2011-05-10 Thread gmarkhor at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48947

   Summary: 4.6.0 fails to link ffmpeg with LTO and gold
   Product: gcc
   Version: lto
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: lto
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: gmark...@gmail.com


I am trying to make ffmpeg snapshot. I configure ffmpeg with the following
line:

../configure --enable-shared --cc='gcc -flto -fuse-linker-plugin -fPIC'
--prefix=/home/markhor/ffmpeg/install --arch=x86_64

It fails to build with
LDlibavcodec/libavcodec.so.53
ffmpeg/libavcodec/jpegls.h:46:0: warning: type of ‘ff_log2_run’ does not match
original declaration [enabled by default]
ffmpeg/libavcodec/jpegls.h:46:0: warning: type of ‘ff_log2_run’ does not match
original declaration [enabled by default]
ffmpeg/libavcodec/bitstream.c:35:15: note: previously declared here
x86_64-unknown-linux-gnu/bin/ld.gold: error: /tmp/ccla9ktI.ltrans3.ltrans.o:
requires dynamic reloc which may overflow at runtime; recompile with -fPIC
x86_64-unknown-linux-gnu/bin/ld.gold: error: /tmp/ccla9ktI.ltrans10.ltrans.o:
requires dynamic reloc which may overflow at runtime; recompile with -fPIC
x86_64-unknown-linux-gnu/bin/ld.gold: error: /tmp/ccla9ktI.ltrans16.ltrans.o:
requires dynamic reloc which may overflow at runtime; recompile with -fPIC
x86_64-unknown-linux-gnu/bin/ld.gold: error: /tmp/ccla9ktI.ltrans21.ltrans.o:
requires dynamic reloc which may overflow at runtime; recompile with -fPIC
collect2: ld returned 1 exit status


--cc='gcc -flto -fPIC' fails the same way. Snapshot is successfully built
without LTO with the BFD linker.


[Bug lto/48947] 4.6.0 fails to link ffmpeg with LTO and gold

2011-05-11 Thread gmarkhor at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48947

--- Comment #2 from Vadim Markovtsev  2011-05-11 
11:43:03 UTC ---
I ensured that. ffmpeg does not use cmake, just ordinary GNU make; no libtool
is called at all down to the point where gcc fails (checked it with "make -n"
and "configure --cc='gcc -v ...'"). fPIC is passed correctly to each CC and LD
call, it is always in COLLECT_GCC_OPTIONS.


[Bug lto/48947] 4.6.0 fails to link ffmpeg with LTO and gold

2011-05-11 Thread gmarkhor at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48947

--- Comment #4 from Vadim Markovtsev  2011-05-11 
17:29:32 UTC ---
I checked those errors with both binutils 2.21 release and 2.22 CVS (10th of
May).


gcc -###
Using built-in specs.
COLLECT_GCC=/???/x86_64-gcc-4.6.0/bin/gcc
COLLECT_LTO_WRAPPER=/???/x86_64-gcc-4.6.0/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/???/x86_64-gcc-4.6.0 --enable-shared
--with-arch=native --enable-languages=c,c++ --enable-lto --enable-plugin
--enable-gold --enable-linker-build-id --disable-multilib --enable-ld=default
--with-plugin-ld=ld.gold
Thread model: posix
gcc version 4.6.0 (GCC)

If you mean CC=gcc -flto -fuse-linker-plugin, I get the same errors.


[Bug lto/48947] 4.6.0 fails to link ffmpeg with LTO and gold

2011-05-24 Thread gmarkhor at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48947

--- Comment #9 from Vadim Markovtsev  2011-05-24 
11:23:43 UTC ---
Here they are


[Bug lto/48947] 4.6.0 fails to link ffmpeg with LTO and gold

2011-05-24 Thread gmarkhor at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48947

--- Comment #8 from Vadim Markovtsev  2011-05-24 
11:23:22 UTC ---
Created attachment 24339
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24339
Objects which cause the error (2)

Last 2 (of 4) binaries


[Bug lto/48947] 4.6.0 fails to link ffmpeg with LTO and gold

2011-05-24 Thread gmarkhor at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48947

--- Comment #7 from Vadim Markovtsev  2011-05-24 
11:22:34 UTC ---
Created attachment 24338
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24338
Objects which cause the error

First 2 (of 4) binaries