[llvm-bugs] [Bug 37998] New: Clang-cl link error exported class with template as base

2018-06-30 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=37998

Bug ID: 37998
   Summary: Clang-cl link error exported class with template as
base
   Product: clang
   Version: 6.0
  Hardware: PC
OS: Windows NT
Status: NEW
  Severity: enhancement
  Priority: P
 Component: -New Bugs
  Assignee: unassignedclangb...@nondot.org
  Reporter: jva...@gmail.com
CC: llvm-bugs@lists.llvm.org

Created attachment 20495
  --> https://bugs.llvm.org/attachment.cgi?id=20495&action=edit
Reproduction

Using MSVC 2017 and Clang-cl 6.0.0
Given link error:

u.clang.obj : error LNK2019: unresolved external symbol "private: int * __cdecl
NS::A::get(void)" (??$get@H@?$A@US@N@@@NS@@AEAAPEAHXZ)
referenced in function "int __cdecl func(int,char * *)" (?func@@YAHHPEAPEAD@Z)

In attachment, you can find the same files as below.

run.cmd
---
cl.exe /nologo /c /GR /EHsc /fp:precise /FS /std:c++17 /diagnostics:caret /O2
/I. /MDd /Zc:forScope /bigobj /Zc:wchar_t t.cpp
cl.exe /nologo /c /GR /EHsc /fp:precise /FS /std:c++17 /diagnostics:caret /O2
/I. /MDd /Zc:forScope /bigobj /Zc:wchar_t u.cpp
cl.exe /nologo /c /GR /EHsc /fp:precise /FS /std:c++17 /diagnostics:caret /O2
/I. /MDd /Zc:forScope /bigobj /Zc:wchar_t m.cpp
move t.obj t.msvc.obj
move u.obj u.msvc.obj
move m.obj m.msvc.obj
link m.msvc.obj t.msvc.obj u.msvc.obj

clang-cl.exe -fms-compatibility-version=19.11 /DBOOST_USE_WINDOWS_H -w
-Wno-unused-command-line-argument  /nologo /c /GR /EHsc /fp:precise /FS
/std:c++17 /diagnostics:caret /O2 /I. /MDd /Zc:forScope /bigobj /Zc:wchar_t
t.cpp
clang-cl.exe -fms-compatibility-version=19.11 /DBOOST_USE_WINDOWS_H -w
-Wno-unused-command-line-argument  /nologo /c /GR /EHsc /fp:precise /FS
/std:c++17 /diagnostics:caret /O2 /I. /MDd /Zc:forScope /bigobj /Zc:wchar_t
u.cpp
clang-cl.exe -fms-compatibility-version=19.11 /DBOOST_USE_WINDOWS_H -w
-Wno-unused-command-line-argument  /nologo /c /GR /EHsc /fp:precise /FS
/std:c++17 /diagnostics:caret /O2 /I. /MDd /Zc:forScope /bigobj /Zc:wchar_t
m.cpp
move t.obj t.clang.obj
move u.obj u.clang.obj
move m.obj m.clang.obj
link m.clang.obj t.clang.obj u.clang.obj


t.h
---
#include 
#ifdef EXPORT_DLL
#define EXPORT __declspec(dllexport)
#else
#define EXPORT __declspec(dllimport)
#endif

namespace N {
struct S {};
} // namespace N

namespace NS {

struct I {
  virtual ~I() = default;
  virtual int *f() = 0;
};

template  class A : public I {
public:
  explicit A() = default;
  virtual ~A() = default;

  A(const A &) = default;
  A(A &&) = default;

  A &operator=(const A &) = default;
  A &operator=(A &&) = default;

  virtual int *f() override { return get(); }

private:
  template ::value>
  struct Impl {
Q *get();
  };

  template  struct Impl {
Q *get() { return nullptr; }
  };

  //! Wrapper method
  template  Q *get();
};
} // namespace NS
namespace N {
class EXPORT B : public NS::A {
public:
  explicit B();
  virtual ~B();

  B(const B &) = default;
  B(B &&) = default;

  B &operator=(const B &) = default;
  B &operator=(B &&) = default;
};
} // namespace N

t.cpp
-
#define EXPORT_DLL
#include "t.h"

namespace NS {

template 
template 
Q *A::Impl::get() {
  static int i = 42;
  return &i;
}

template  template  Q *A::get() {
  return Impl().get();
}

} // namespace NS

using namespace N;
using namespace NS;

B::B() = default;
B::~B() = default;

template class EXPORT NS::A;

u.cpp
-
#define EXPORT_DLL
#include "t.h"

using namespace N;

int func(int, char **) {
  auto b = B{};

  return *b.f();
}

m.cpp
-
#include "t.h"

using namespace N;

int main(int, char **) {
  auto b = B{};

  return *b.f();
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[llvm-bugs] [Bug 37999] New: Unsequenced warnings displayed inconsistently

2018-06-30 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=37999

Bug ID: 37999
   Summary: Unsequenced warnings displayed inconsistently
   Product: clang
   Version: 6.0
  Hardware: PC
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P
 Component: -New Bugs
  Assignee: unassignedclangb...@nondot.org
  Reporter: dilyan.palau...@aegee.org
CC: llvm-bugs@lists.llvm.org

With this program:

#include 
#include 

int main() {
  char g[] = "ABC";
  int i =0;
  g[i] = tolower(g[i++]);
  printf("g=%s, i=%i\n", g, i);
}

and clang 6.0.0 (not 6.0.1) I get:

$ clang -O0 plus.c
plus.c:7:21: warning: unsequenced modification and access to 'i'
[-Wunsequenced]
  g[i] = tolower(g[i++]);
~   ^
1 warning generated.

but 
$ clang -O1 plus.c
-> No warnings

As the first call (-O0) emits warnings, I would expect that the second call
(-O1) emits the same warnings.

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[llvm-bugs] [Bug 38000] New: State at llvm.org where to downlad LLVM 6.0.1

2018-06-30 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38000

Bug ID: 38000
   Summary: State at llvm.org where to downlad LLVM 6.0.1
   Product: Website
   Version: unspecified
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P
 Component: General Website
  Assignee: unassignedb...@nondot.org
  Reporter: dilyan.palau...@aegee.org
CC: llvm-bugs@lists.llvm.org

Providing that http://releases.llvm.org/download.html contains version 6.0.1
update www.llvm.org on the left -> Download to state 6.0.1 instead of 6.0.1,
and to link to http://releases.llvm.org/download.html#6.0.1 instead of
http://releases.llvm.org/download.html#6.0.0.

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[llvm-bugs] [Bug 37119] Compiler miscompiling code after r329525 when optimizations are enabled

2018-06-30 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=37119

Simon Pilgrim  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
 Fixed By Commit(s)|335637  |335637,336048

--- Comment #5 from Simon Pilgrim  ---
Vector codegen was fixed at rL336048

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[llvm-bugs] [Bug 38001] New: Reading a 8-byte aligned f128 emits a movaps instruction

2018-06-30 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38001

Bug ID: 38001
   Summary: Reading a 8-byte aligned f128 emits a movaps
instruction
   Product: tools
   Version: 6.0
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P
 Component: llc
  Assignee: unassignedb...@nondot.org
  Reporter: eduardosanchezmu...@gmail.com
CC: llvm-bugs@lists.llvm.org

Created attachment 20496
  --> https://bugs.llvm.org/attachment.cgi?id=20496&action=edit
Example LLVM IR

Using load on a f128 with align 8 emits a movaps instruction (on x86-64 with
mmx), which expects a 16-byte aligned address.

An example IR is attached. It can be compiled with
llc -march=x86-64 -mattr=+mmx -O1 movaps.ll

The output of llc -version is:
LLVM (http://llvm.org/):
  LLVM version 6.0.0
  Optimized build.
  Default target: x86_64-pc-linux-gnu
  Host CPU: skylake

  Registered Targets:
aarch64- AArch64 (little endian)
aarch64_be - AArch64 (big endian)
amdgcn - AMD GCN GPUs
arm- ARM
arm64  - ARM64 (little endian)
armeb  - ARM (big endian)
bpf- BPF (host endian)
bpfeb  - BPF (big endian)
bpfel  - BPF (little endian)
hexagon- Hexagon
lanai  - Lanai
mips   - Mips
mips64 - Mips64 [experimental]
mips64el   - Mips64el [experimental]
mipsel - Mipsel
msp430 - MSP430 [experimental]
nvptx  - NVIDIA PTX 32-bit
nvptx64- NVIDIA PTX 64-bit
ppc32  - PowerPC 32
ppc64  - PowerPC 64
ppc64le- PowerPC 64 LE
r600   - AMD GPUs HD2XXX-HD6XXX
sparc  - Sparc
sparcel- Sparc LE
sparcv9- Sparc V9
systemz- SystemZ
thumb  - Thumb
thumbeb- Thumb (big endian)
x86- 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64
xcore  - XCore

I have installed LLVM from Manjaro repositories.

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[llvm-bugs] [Bug 38002] New: Missed opportunity for SETE for 2-cases switch

2018-06-30 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38002

Bug ID: 38002
   Summary: Missed opportunity for SETE for 2-cases switch
   Product: libraries
   Version: trunk
  Hardware: PC
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P
 Component: Backend: X86
  Assignee: unassignedb...@nondot.org
  Reporter: david.bolvan...@gmail.com
CC: llvm-bugs@lists.llvm.org

Hello,

Code:
bool sw1(int x) {
switch(x) {
case 3:
case 5:
return true;

default:
return false;
}
}

Clang trunk -03/Os:
sw1(int): # @sw1(int)
  mov al, 1
  cmp edi, 3
  je .LBB0_3
  cmp edi, 5
  jne .LBB0_2<--- avoid jump, use "sete al"?
.LBB0_3:
  ret
.LBB0_2:
  xor eax, eax
  ret

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[llvm-bugs] [Bug 38003] New: Fold AND+CMP to CMP

2018-06-30 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38003

Bug ID: 38003
   Summary: Fold AND+CMP to CMP
   Product: libraries
   Version: trunk
  Hardware: PC
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P
 Component: Scalar Optimizations
  Assignee: unassignedb...@nondot.org
  Reporter: david.bolvan...@gmail.com
CC: llvm-bugs@lists.llvm.org

Hello,

bool sw1(int x) {
switch(x) {
case 2:
case 5:
case 6:
case 31:
return true;

default:
return false;
}
}

Clang -03
sw1(int): 
  add edi, -2 // why?
  cmp edi, 29 // fold add + cmp to cmp edi, 31
  ja .LBB0_2
  mov eax, 536870937
  mov ecx, edi
  shr eax, cl
  and eax, 1
  ret
.LBB0_2:
  xor eax, eax
  ret


GCC 8.1 emits:
sw1(int):
  xor eax, eax
  cmp edi, 31
  ja .L1
  mov eax, 1
  mov ecx, edi
  sal rax, cl
  test eax, 2147483752
  setne al
.L1:
  ret

ICC 18  (more jumps, worse code?):
sw1(int):
  cmp edi, 64
  jae ..B1.4 
  mov rax, 0x08068 
  bt rax, rdi 
  jnc ..B1.4 
  mov eax, 1
  ret 
..B1.4: 
  xor eax, eax
  ret

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[llvm-bugs] [Bug 38004] New: Crash of clang for debug build

2018-06-30 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38004

Bug ID: 38004
   Summary: Crash of clang for debug build
   Product: clang
   Version: 6.0
  Hardware: PC
OS: Windows NT
Status: NEW
  Severity: enhancement
  Priority: P
 Component: -New Bugs
  Assignee: unassignedclangb...@nondot.org
  Reporter: jva...@gmail.com
CC: llvm-bugs@lists.llvm.org

Using Clang-cl (6.0.0) with MSVC2017

Compile command:
clang-cl.exe -fms-compatibility-version=19.11  
-Wno-unused-command-line-argument /nologo /c /GR /EHsc  /std:c++17   /Od  /Z7 
t.cpp -w

t.cpp
-
#include 
struct A;

template 
struct B
   {
   };

struct C
   {
   template 
   static constexpr auto v = std::conjunction_v...>;

   template 
   static constexpr auto v> = v;
   };

C c{};

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[llvm-bugs] [Bug 38005] New: Assertion failed: RD->isAggregate() && "aggregate init on non-aggregate"

2018-06-30 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38005

Bug ID: 38005
   Summary: Assertion failed: RD->isAggregate() && "aggregate init
on non-aggregate"
   Product: clang
   Version: trunk
  Hardware: PC
OS: Windows NT
Status: NEW
  Severity: enhancement
  Priority: P
 Component: -New Bugs
  Assignee: unassignedclangb...@nondot.org
  Reporter: jva...@gmail.com
CC: llvm-bugs@lists.llvm.org

Found on LLVM trunk (rev63) with MSVC2017

Command
---
clang-cl.exe -fms-compatibility-version=19.11 /nologo /c  /GR /EHsc /std:c++17 
  t.cpp  -w

t.cpp
-
#include 
#include 

struct C {
  using const_iterator = std::vector::const_iterator;

  const_iterator cbegin() const;
  const_iterator cend() const;

private:
  std::vector v;
};

C f();
void g() {
  for (auto c : C{f()}) {
  }
}

error
-
Assertion failed: RD->isAggregate() && "aggregate init on non-aggregate", file
C:\src\llvm_package_63\llvm\tools\clang\lib\Sema\SemaInit.cpp, line 6351

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[llvm-bugs] [Bug 38006] New: test/DebugInfo/MIR/X86/no-cfi-loc.mir fails assertion for x86_64-pc-windows-gnu

2018-06-30 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38006

Bug ID: 38006
   Summary: test/DebugInfo/MIR/X86/no-cfi-loc.mir fails assertion
for x86_64-pc-windows-gnu
   Product: new-bugs
   Version: trunk
  Hardware: PC
OS: Windows NT
Status: NEW
  Severity: normal
  Priority: P
 Component: new bugs
  Assignee: unassignedb...@nondot.org
  Reporter: yaron.ke...@gmail.com
CC: llvm-bugs@lists.llvm.org, paul.robin...@am.sony.com,
paul_robin...@playstation.sony.com

test/DebugInfo/MIR/X86/no-cfi-loc.mir fails when targetting for
x86_64-pc-windows-gnu:


 TEST 'LLVM :: DebugInfo/MIR/X86/no-cfi-loc.mir' FAILED

Script:
--
: 'RUN: at line 3';   C:\llvm\build\RelWithDebInfo\bin\llc.EXE
-start-after=prologepilog -march=x86-64 -use-unknown-locations=Enable
C:\llvm\llvm\test\DebugInfo\MIR\X86\no-cfi-loc.mir -o - |
C:\llvm\build\RelWithDebInfo\bin\FileCheck.EXE
C:\llvm\llvm\test\DebugInfo\MIR\X86\no-cfi-loc.mir
--
Exit Code: 2

Command Output (stdout):
--
$ ":" "RUN: at line 3"
$ "C:\llvm\build\RelWithDebInfo\bin\llc.EXE" "-start-after=prologepilog"
"-march=x86-64" "-use-unknown-locations=Enable"
"C:\llvm\llvm\test\DebugInfo\MIR\X86\no-cfi-loc.mir" "-o" "-"
# command stderr:
Assertion failed: HasWinCFI.hasValue() && "HasWinCFI not set yet!", file
C:\llvm\llvm\include\llvm/CodeGen/MachineFunction.h, line 487



LLVM trunk r336052 was built using Visual C++ targetting x86_64-pc-windows-gnu
and with assertions on:

cmake -G "Visual Studio 14 Win64" -Thost=x64
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-pc-windows-gnu
-DLLVM_ENABLE_ASSERTIONS:BOOL=ON -DLLVM_USE_CRT_DEBUG=MTd
-DLLVM_USE_CRT_RELWITHDEBINFO=MTd -DLLVM_USE_CRT_RELEASE=MT ../llvm



should the test pass at all or is it unsupported on x86_64-pc-windows-gnu?

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[llvm-bugs] [Bug 38007] New: sigsegv in llvm::PMTopLevelManager::addImmutablePass

2018-06-30 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38007

Bug ID: 38007
   Summary: sigsegv in llvm::PMTopLevelManager::addImmutablePass
   Product: new-bugs
   Version: 6.0
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P
 Component: new bugs
  Assignee: unassignedb...@nondot.org
  Reporter: gie...@gentoo.org
CC: llvm-bugs@lists.llvm.org

The test is run on Gentoo linux amd64, with clang 6.0.1 (or 6.0.0) compiled
to use gold as its default linker:

-DCLANG_DEFAULT_LINKER=/usr/bin/ld.gold'

Compiling a trivial program:

argus% cat main.c
int main(){ return 0; }
argus% 

clang its a debug assertion, or crashes with a SIGSEGV when compiled without
debug:

argus% clang -save-temps -v -flto=thin
-Wl,-plugin=/usr/lib/llvm/6/lib64/LLVMgold.so main.c
clang version 6.0.1 (tags/RELEASE_601/final)
...
See the attached file clang-lto-plugin-sigsegv-bug-report.txt for the
stack trace.

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[llvm-bugs] Issue 9202 in oss-fuzz: llvm/clang-llvm-proto-fuzzer: ASSERT: OS.tell() - Start == FragmentSize && "The stream should advance by fragment size

2018-06-30 Thread ClusterFuzz-External via monorail via llvm-bugs

Status: New
Owner: 
CC: k...@google.com, masc...@google.com, jdevlieg...@apple.com,  
igm...@gmail.com, llvm-b...@lists.llvm.org, j...@chromium.org,  
v...@apple.com, mitchphi...@outlook.com, xpl...@gmail.com,  
akils...@apple.com
Labels: ClusterFuzz Stability-Memory-AddressSanitizer Reproducible  
Engine-libfuzzer Proj-llvm Reported-2018-07-01

Type: Bug

New issue 9202 by ClusterFuzz-External: llvm/clang-llvm-proto-fuzzer:  
ASSERT: OS.tell() - Start == FragmentSize && "The stream should advance by  
fragment size

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9202

Detailed report: https://oss-fuzz.com/testcase?key=6516072046919680

Project: llvm
Fuzzer: libFuzzer_llvm_clang-llvm-proto-fuzzer
Fuzz target binary: clang-llvm-proto-fuzzer
Job Type: libfuzzer_asan_llvm
Platform Id: linux

Crash Type: ASSERT
Crash Address:
Crash State:
  OS.tell() - Start == FragmentSize && "The stream should advance by  
fragment size

  llvm::MCAssembler::writeSectionData
  ELFWriter::writeObject

Sanitizer: address (ASAN)

Regressed:  
https://oss-fuzz.com/revisions?job=libfuzzer_asan_llvm&range=201806250758:201806260706


Reproducer Testcase:  
https://oss-fuzz.com/download?testcase_id=6516072046919680


Issue filed automatically.

See https://github.com/google/oss-fuzz/blob/master/docs/reproducing.md for  
more information.


When you fix this bug, please
  * mention the fix revision(s).
  * state whether the bug was a short-lived regression or an old bug in any  
stable releases.

  * add any other useful information.
This information can help downstream consumers.

If you need to contact the OSS-Fuzz team with a question, concern, or any  
other feedback, please file an issue at  
https://github.com/google/oss-fuzz/issues.


--
You received this message because:
  1. You were specifically CC'd on the issue

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

Reply to this email to add a comment.
___
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs