[llvm-bugs] [Bug 38261] New: The "HowToUseJit" example program seg faults

2018-07-22 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38261

Bug ID: 38261
   Summary: The "HowToUseJit" example program seg faults
   Product: Documentation
   Version: 6.0
  Hardware: PC
OS: Windows NT
Status: NEW
  Severity: normal
  Priority: P
 Component: General docs
  Assignee: unassignedb...@nondot.org
  Reporter: shivans...@gmail.com
CC: llvm-bugs@lists.llvm.org

I compiled LLVM 6.0.0 on Windows for x64 as a DLL, and tried running the
"HowToUseJit" example program, and it seg faulted.

I had to make the following 2 modifications to make the example functional:

Add the following include:
#include "llvm/ExecutionEngine/MCJIT.h"

I also added a call to this function inside main:
LLVMInitializeNativeAsmPrinter();

The example should be updated with these 2 fixes.

As a side note, I also compiled LLVM as a static lib, and when I linked my
program against that static lib, I didn't need to #include MCJIT.h. So it
didn't segfault in that case. But I still had to add a call to the function
"LLVMInitializeNativeAsmPrinter" in order to make the example work.

-- 
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 9397 in oss-fuzz: llvm: Build failure

2018-07-22 Thread ClusterFuzz-External via monorail via llvm-bugs


Comment #3 on issue 9397 by ClusterFuzz-External: llvm: Build failure
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9397#c3

Friendly reminder that the the build is still failing.
Please try to fix this failure to ensure that fuzzing remains productive.
Latest build log:  
https://oss-fuzz-build-logs.storage.googleapis.com/log-c3806020-6ab6-4f50-ab6a-eddfe7e1fff6.txt



--
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


[llvm-bugs] [Bug 38262] New: clang-cl defines outdated values for _MSVC_LANG

2018-07-22 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38262

Bug ID: 38262
   Summary: clang-cl defines outdated values for _MSVC_LANG
   Product: clang
   Version: 6.0
  Hardware: PC
OS: Windows NT
Status: NEW
  Severity: normal
  Priority: P
 Component: Frontend
  Assignee: unassignedclangb...@nondot.org
  Reporter: ca...@carter.net
CC: llvm-bugs@lists.llvm.org

clang-cl.exe from Clang 6.0.0 (apologies if this report isn't valid for 6.0.1 -
I can't test it easily) predefines _MSVC_LANG to 201403 when passed both
/std:c++17 and /std:c++latest. These values don't agree with cl.exe's values
for the VS2017 release series. cl.exe predefines _MSVC_LANG to 201402, 201703,
and 201704 when passed /std:c++14, /std:c++17, and /std:c++latest respectively.

-- 
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 38263] New: Enable LoopInterchange by default

2018-07-22 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38263

Bug ID: 38263
   Summary: Enable LoopInterchange by default
   Product: libraries
   Version: trunk
  Hardware: PC
OS: All
Status: NEW
  Severity: enhancement
  Priority: P
 Component: Loop Optimizer
  Assignee: unassignedb...@nondot.org
  Reporter: florian.h...@arm.com
CC: llvm-bugs@lists.llvm.org

Over the last year, the LoopInterchange pass has seen some improvements fixing
all known/reported bugs.

Currently the pass is still quite limited in the types of loops is supports and
I think we should get a few improvements in before we consider enabling it by
default:
  * Add support for reductions (PR30472), https://reviews.llvm.org/D43245
  * Use cache-based cost model (https://reviews.llvm.org/D35210)

-- 
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 38264] New: Missed optimizations for comparison with multiplications

2018-07-22 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38264

Bug ID: 38264
   Summary: Missed optimizations for comparison with
multiplications
   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,

int f2(int x, int y, int z) {
int tmp = y--;
if (tmp * x > x * y)
return 1;
return 0;
}

Current codegen:
f2(int, int, int): # @f2(int, int, int)
  lea ecx, [rsi - 1]
  imul esi, edi
  imul ecx, edi
  xor eax, eax
  cmp esi, ecx
  setg al
  ret

GCC:
f2(int, int, int):
  xor eax, eax
  test edi, edi
  setg al
  ret



/
int f2(int x, int y, int z) {
if ((y-1) * x > x * y)
return 1;
return 0;
}

f2(int, int, int): # @f2(int, int, int)
  lea ecx, [rsi - 1]
  imul ecx, edi
  imul esi, edi
  xor eax, eax
  cmp ecx, esi
  setg al
  ret

GCC:
f2(int, int, int):
  mov eax, edi
  shr eax, 31
  ret


For unsigned case - Clang:
f2(unsigned int, unsigned int, unsigned int): # @f2(unsigned int, unsigned int,
unsigned int)
  lea ecx, [rsi - 1]
  imul ecx, edi
  imul esi, edi
  xor eax, eax
  cmp ecx, esi
  seta al
  ret

GCC (one multiplication is eliminated):
f2(unsigned int, unsigned int, unsigned int):
  sub esi, 1
  xor eax, eax
  imul esi, edi
  add esi, edi
  setc al
  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 38265] New: value-initialization of incomplete type

2018-07-22 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38265

Bug ID: 38265
   Summary: value-initialization of incomplete type
   Product: clang
   Version: trunk
  Hardware: PC
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P
 Component: C++
  Assignee: unassignedclangb...@nondot.org
  Reporter: zhong...@pku.org.cn
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

The code is as follow:

struct x0
{
 x0 () = default;
};
struct x1
{
 x0 x2[];
 void x3 ()
 {
 x1 ();
 }
};

clang++ accepts it, but g++ rejects it:

code0.cpp:7:8: error: flexible array member 'x1::x2' in an otherwise empty
'struct x1'
  x0 x2[];
^
code0.cpp: In member function 'void x1::x3()':
code0.cpp:10:6: error: value-initialization of incomplete type 'x0 []'
  x1 ();

-- 
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 38266] New: taking address of temporary array

2018-07-22 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38266

Bug ID: 38266
   Summary: taking address of temporary array
   Product: clang
   Version: trunk
  Hardware: PC
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P
 Component: C++
  Assignee: unassignedclangb...@nondot.org
  Reporter: zhong...@pku.org.cn
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

The code is as follow:

#include 

void fn(int arr[])
{
 for (int j = 0; j < 5; ++j)
 printf("%d: %d\n", j, arr[j]);
}

int main()
{
 fn((int[]) { 41, 42, 43, 44, 45 } );
 return 0;
}

clang++ accepts it but g++ rejects it:

code5.cpp: In function 'int main()':
code5.cpp:11:13: error: taking address of temporary array
  fn((int[]) { 41, 42, 43, 44, 45 } );
 ^~

Here is another code sample:

extern "C" int printf(const char*, ...);
int main() { 
 using A = int[1];
 printf("%p\n", A{1} );
}

clang++ again accepts it, but g++ rejects it:


code6.cpp: In function 'int main()':
code6.cpp:4:17: error: taking address of temporary array
  printf("%p\n", A{1} );
 ^~~~

-- 
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 38267] New: alignas example won't compile

2018-07-22 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38267

Bug ID: 38267
   Summary: alignas example won't compile
   Product: clang
   Version: trunk
  Hardware: PC
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P
 Component: C++
  Assignee: unassignedclangb...@nondot.org
  Reporter: zhong...@pku.org.cn
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

The code is as follow:

char alignas(128) cacheline[128];

This example is given here: http://en.cppreference.com/w/cpp/language/alignas

clang++ rejects it:

code2.cpp:1:6: error: 'alignas' attribute cannot be applied to types
char alignas(128) cacheline[128];
 ^
1 error generated.

Instead, g++ accepts the above code sample.

-- 
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 38268] New: class template partial specialization contains a template parameter that cannot be deduced

2018-07-22 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38268

Bug ID: 38268
   Summary: class template partial specialization contains a
template parameter that cannot be deduced
   Product: clang
   Version: trunk
  Hardware: PC
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P
 Component: C++
  Assignee: unassignedclangb...@nondot.org
  Reporter: zhong...@pku.org.cn
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

The code is as follow:

template 
 struct outer
 {
 template 
 struct inner
 {

 };
 };


 template 
 struct is_inner_for
 {
 template 
 struct predicate
 {
 static constexpr bool value = false;
 };

 template 
 struct predicate::template inner>
 {
 static constexpr bool value = true;
 };
 };

clang++ rejects the code:

code0.cpp:22:9: error: class template partial specialization contains a
  template parameter that cannot be deduced; this partial specialization
  will never be used [-Wunusable-partial-specialization]
 struct predicate::template inner>
^~~
code0.cpp:21:21: note: non-deducible template parameter 'U'
 template 
^
1 error generated.

g++ 4.8, 5.2 accept the above code. It seems to be difficult to determine
whether the code is legal or not. I found that g++ 6 rejects the code with a
similar message:

code0.cpp:22:9: error: template parameters not deducible in partial
specialization:
  struct predicate::template inner> :
std::true_type
 ^~~
code0.cpp:22:9: note: 'U'
code0.cpp:26:1: error: static assertion failed: Yay!
 static_assert(
 ^

However, g++ 9.0 again accepts the code.

-- 
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 38269] New: no matching function for call to 'f'

2018-07-22 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38269

Bug ID: 38269
   Summary: no matching function for call to 'f'
   Product: clang
   Version: trunk
  Hardware: PC
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P
 Component: C++
  Assignee: unassignedclangb...@nondot.org
  Reporter: zhong...@pku.org.cn
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

The code is as follow:

template struct A { };
template void f( A...p);

void g() { 
 f( 
 A(),
 A() 
 );
}

clang++ rejects it:


code0.cpp:5:2: error: no matching function for call to 'f'
 f( 
 ^~
code0.cpp:2:40: note: candidate template ignored: substitution failure :
  deduced incomplete pack  for template parameter 'T'
template void f( A...p);
  ~^
1 error generated.

g++, instead, accepts it. BTW, T shall end up as {int,short}?

-- 
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 38270] New: Rewriter crashes when compilation database contains files with same name

2018-07-22 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38270

Bug ID: 38270
   Summary: Rewriter crashes when compilation database contains
files with same name
   Product: clang
   Version: 6.0
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P
 Component: -New Bugs
  Assignee: unassignedclangb...@nondot.org
  Reporter: hyunsu.li...@gmail.com
CC: llvm-bugs@lists.llvm.org

Created attachment 20586
  --> https://bugs.llvm.org/attachment.cgi?id=20586&action=edit
Example build system and program that I created to reproduce the bug

# Overview

If the compilation database contains the files with same name but different
path and size, the program written using clang libtooling and clang Rewriter
crashes.


# Steps to Reproduce

1) Create the build system that generates the following
`compile_commands.json`:
```json
[
{
"arguments": [
"cc",
"-c",
"-o",
"a.o",
"a.c"
],
"directory": "/home/user/build_system/lib",
"file": "a.c"
},
{
"arguments": [
"cc",
"-c",
"-o",
"a.o",
"a.c"
],
"directory": "/home/user/build_system/src",
"file": "a.c"
}
]
```
In here, the length of the content of `/home/user/build_system/src/a.c`
**should be larger** than that of `/home/user/build_system/lib/a.c`.

The example build system I created is attached for reference. For detailed
description about the attachment, check # About Attachment section

2) Create a program with clang libtooling, which reads the compilation database
and for every file in compilation database, does rewriting on every statement
in the file.

The example program I created is attached for reference. For detailed
description about the attachment, check # About Attachment section

3) Run the program on the created compilation database. The program runs
cleanly on `lib/a.c`, but it shows segfault when processing `src/a.c`.


# Actual Results

The program with clang libtooling shows segfault.


# Expected Results

The program with clang libtooling should run cleanly, not showing segfault.


# Tested Environment

 - OS: Ubuntu LTS 16.04 Xenial
 - LLVM Version: 6.0.1


# About Attachment

This section describes the details of attachment.

- `build_example/`: Example build system
  - `lib/`
- `a.c`: Example c file (shorter one)
- `Makefile`: A makefile to compile `a.c`
  - `src/`
- `a.c`: Example c file (longer one)
- `Makefile`: A makefile to compile `a.c`
  - `compile_commands.json`: Compilation database. This file is generated by
running the command `$ bear make`
  - `Makefile`: A makefile to build the whole example build system
- `Makefile`: A makefile to build `target.cpp`
- `target.cpp`: A program that uses clang libtooling and clang Rewriter. This
program fails when run on the given compilation database, which shouldn't


# Other Comments

I also used `clang-check` on `lib/a.c` and `src/a.c` (`$ clang-check lib/a.c
src/a.c`), and it shows errors with `src/a.c` which are not actual errors.

I think when the SourceManager processes `src/a.c`, it uses the buffer that is
created when processing `lib/a.c` (because it has same file name), and this
causes an error.

-- 
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 38267] alignas example won't compile

2018-07-22 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38267

Richard Smith  changed:

   What|Removed |Added

 CC||richard-l...@metafoo.co.uk
 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from Richard Smith  ---
GCC is wrong, alignas is not a type attribute so cannot appear in this
position.

-- 
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 38266] taking address of temporary array

2018-07-22 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38266

Richard Smith  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|NEW |RESOLVED
 CC||richard-l...@metafoo.co.uk

--- Comment #2 from Richard Smith  ---
The code is fine, array to pointer decay is permitted on array temporaries.

-- 
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 38265] value-initialization of incomplete type

2018-07-22 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=38265

Richard Smith  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 CC||richard-l...@metafoo.co.uk
 Status|NEW |RESOLVED

--- Comment #1 from Richard Smith  ---
Clang's flexible array member extension isn't the same as GCC's, and allows
this.

-- 
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 37249] Using Wreturn-std-move: false positive warning on some containers

2018-07-22 Thread via llvm-bugs
https://bugs.llvm.org/show_bug.cgi?id=37249

a...@mozilla.com changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|NEW |RESOLVED

--- Comment #11 from a...@mozilla.com ---
Setting this to Resolved per what we've discussed in this thread. Indeed the
intent of this warning is not to also include a complexity estimator and based
on that to deduct if it should be triggered or not.

-- 
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