[Bug c++/81237] Cannot link when class methods compiled with different levels of vectorization

2017-07-20 Thread ravi.kappiy...@cd-adapco.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81237

--- Comment #5 from Ravi <ravi.kappiy...@cd-adapco.com> ---
Are there any known work-arounds to getting ABI version 11 to link against code
compiled with an older ABI version?

[Bug c++/81237] Cannot link when class methods compiled with different levels of vectorization

2017-06-28 Thread ravi.kappiy...@cd-adapco.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81237

--- Comment #4 from Ravi <ravi.kappiy...@cd-adapco.com> ---
This does seem to be an issue with any ABI version older than the newest (11, I
think), which appears to have a different name mangling scheme than any of ABI
versions 6-10, all of which fail when attempting to link against an object file
compiled against the latest ABI. This was not the case with GNU 6.2 which used
ABI version 10, which appears to be compatible with ABI version 6.
Unfortunately, due to other constraints we are forced to use ABI version 6 for
certain aspects of the code - are there any known work-arounds to getting ABI
version 11 to link against code compiled with an older ABI version?

[Bug c++/81237] Cannot link when class methods compiled with different levels of vectorization

2017-06-27 Thread ravi.kappiy...@cd-adapco.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81237

--- Comment #2 from Ravi <ravi.kappiy...@cd-adapco.com> ---
I noticed I neglected to mention the error message. Compiling the code with GNU
7.1 gives me the error:

test.o:(.data.rel.ro._ZTV1C[_ZTV1C]+0x38): undefined reference to `non-virtual
thunk to C::func() const'
collect2: error: ld returned 1 exit status

"ld -v" Returns "GNU ld (GNU Binutils) 2.24)" for both GNU 6.2 and GNU 7.1
builds.

[Bug c++/81237] Cannot link when class methods compiled with different levels of vectorization

2017-06-27 Thread ravi.kappiy...@cd-adapco.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81237

--- Comment #1 from Ravi <ravi.kappiy...@cd-adapco.com> ---
The markdown didn't work quite the way I thought it would... Let me know if the
format is unclear and I'll rework the initial message to make it clearer

[Bug c++/81237] New: Cannot link when class methods compiled with different levels of vectorization

2017-06-27 Thread ravi.kappiy...@cd-adapco.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81237

Bug ID: 81237
   Summary: Cannot link when class methods compiled with different
levels of vectorization
   Product: gcc
   Version: 7.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ravi.kappiy...@cd-adapco.com
  Target Milestone: ---

I have 4 files (2 CPP files, 1 header file, and 1 Makefile), shown below:

**test.h**
#ifndef test_h_
#define test_h_

#include 

class A
{
public:
  virtual ~A() {}
protected:
};
class B
{
public:
  virtual std::string const func() const = 0;
protected:
  B() {}
  virtual ~B() {}
};
class C : public A
, public B
{
public:
  ~C();
private:
  std::string const func() const;
};

#endif

**test.cpp**
#include "test.h"

C::~C() {}

**test2.cpp**
#include "test.h"

std::string const
C::func() const
{
  return 0;
}

**Makefile**
all:
${MIRROR_HOME}/compilers/linux-x86_64-2.10.1/gnu7.1.0/bin/g++ -O3
--param inline-unit-growth=1000 -fPIC -o test2.o -c test2.cpp
${MIRROR_HOME}/compilers/linux-x86_64-2.10.1/gnu7.1.0/bin/g++ -fPIC -O3
--param inline-unit-growth=1000 -shared -z defs -Wl,--as-needed -shared
-Wl,-soname,libTest2.so -o libTest2.so test2.o
${MIRROR_HOME}/compilers/linux-x86_64-2.10.1/gnu7.1.0/bin/g++ -O3
--param inline-unit-growth=1000 -fPIC -mavx512f -fabi-version=6 -o test.o -c
test.cpp
${MIRROR_HOME}/compilers/linux-x86_64-2.10.1/gnu7.1.0/bin/g++ -fPIC -O3
--param inline-unit-growth=1000 -shared -z defs -Wl,--as-needed -shared
-Wl,-soname,libTest.so -o libTest.so test.o libTest2.so

old:
${MIRROR_HOME}/compilers/linux-x86_64-2.10.1/gnu6.2.0/bin/g++ -O3
--param inline-unit-growth=1000 -fPIC -o test2.o -c test2.cpp
${MIRROR_HOME}/compilers/linux-x86_64-2.10.1/gnu6.2.0/bin/g++ -fPIC -O3
--param inline-unit-growth=1000 -shared -z defs -Wl,--as-needed -shared
-Wl,-soname,libTest2.so -o libTest2.so test2.o
${MIRROR_HOME}/compilers/linux-x86_64-2.10.1/gnu6.2.0/bin/g++ -O3
--param inline-unit-growth=1000 -fPIC -mavx512f -fabi-version=6 -o test.o -c
test.cpp
${MIRROR_HOME}/compilers/linux-x86_64-2.10.1/gnu6.2.0/bin/g++ -fPIC -O3
--param inline-unit-growth=1000 -shared -z defs -Wl,--as-needed -shared
-Wl,-soname,libTest.so -o libTest.so test.o libTest2.so

* **test2.cpp** is compiled with SSE2 instructions to create **libTest2.so**
* **test.cpp** is compiled with AVX-512 instructions (the flags "-mavx512f
-fabi-version=6" are added to it's compile)
* If both CPP files are instead compiled with the same vectorization level (via
the removal of the extra flags for **test.cpp** or the addition of the same
flags for **test2.cpp**), then the compile works as expected. 
* The linker appears to be getting confused when some of the methods in the
class are compiled with one vectorization level, while other methods are
compiled with another, causing the "undefined reference" error.
* As far as I am aware, it is not illegal via the standard to compile certain
methods of a class with one level of vectorization and not other methods - this
appears to be a compiler bug.
* When using "make old" (i.e., using GNU 6.2 instead of GNU 7.1), the compile
works as expected even when using different levels of vectorization.