[llvm-bugs] [Bug 30491] [regression] clang crash on __has_nothrow_copy

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=30491

Philippe  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #1 from Philippe  ---


*** This bug has been marked as a duplicate of bug 29087 ***

-- 
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 31169] New: [inline asm] asm goto not supported

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31169

Bug ID: 31169
   Summary: [inline asm] asm goto not supported
   Product: new-bugs
   Version: unspecified
  Hardware: PC
OS: Windows NT
Status: NEW
  Severity: normal
  Priority: P
 Component: new bugs
  Assignee: unassignedb...@nondot.org
  Reporter: ziv.iz...@intel.com
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

the following example doesn't compile in clang, however, gcc,icc do compile it:

void foo(int i, int j)
{
  __asm goto ("cmp %0,%1; je %l2" : : "r"(i), "r"(j) : : skip_stuff);
skip_stuff:
  return ;
}

The error message recieved in clang is:

:3:9: error: 'asm goto' constructs are not supported yet
__asm goto ("cmp %0,%1; je %l2" : : "r"(i), "r"(j) : : skip_stuff);
^
1 error generated.
Compiler exited with result code 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 31170] New: [AARCH64] SIMD instructions are emitted without proper address alignment

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31170

Bug ID: 31170
   Summary: [AARCH64] SIMD instructions are emitted without proper
address alignment
   Product: clang
   Version: 3.8
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P
 Component: LLVM Codegen
  Assignee: unassignedclangb...@nondot.org
  Reporter: sergio.more...@gmail.com
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

Created attachment 17656
  --> https://llvm.org/bugs/attachment.cgi?id=17656&action=edit
Sample C code

Hi,

I'm compiling a very simple memset() implementation for AARCH64. See the
attached file.

clang is generating a couple of SIMD store instructions without checking if the
address is aligned. When run on a target (e.g. Hikey board) it crashes with an
alignment fault.

I tested both clang-3.8 that is available on Ubuntu 16.04 Server, as well as a
build of clang-4.0 from SVN.

$ /opt/llvm/bin/clang-4.0 --target=aarch64 -c -O2 LibC.c -o LibC.o -isystem
/usr/aarch64-linux-gnu/include/
$ aarch64-linux-gnu-objdump -d -x LibC.o

0088 :
  88:   b40002c2cbz x2, e0 
  8c:   f100805fcmp x2, #0x20
  90:   540001e3b.cccc 
  94:   927be84aand x10, x2, #0xffe0
  98:   b40001aacbz x10, cc 
  9c:   8b0a0008add x8, x0, x10
  a0:   cb0a0049sub x9, x2, x10
  a4:   4e010c20dup v0.16b, w1
  a8:   9100400badd x11, x0, #0x10
  ac:   aa0a03ecmov x12, x10
  b0:   ad3f8160stp q0, q0, [x11,#-16]<- x11 can be unaligned.


Let me know if you need more information.

$ /opt/llvm/bin/clang-4.0 -v
clang version 4.0.0 (trunk 287757)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/llvm/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

-- 
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 31171] New: [inline asm] clang ungracefull exit, asm regex

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31171

Bug ID: 31171
   Summary: [inline asm]  clang ungracefull exit, asm regex
   Product: new-bugs
   Version: unspecified
  Hardware: PC
OS: All
Status: NEW
  Severity: normal
  Priority: P
 Component: new bugs
  Assignee: unassignedb...@nondot.org
  Reporter: ziv.iz...@intel.com
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

the following code crashes instead of gracefully exit:

void add(volatile int* __mem, int __val)
{
__asm__ ("add{l} {%1,%0 {#dst last}|%0,%1}" /* illegal */
  : "=m" (*__mem) : "ir" (__val) );
}

output:

fatal error: error in backend: Nested variants found in inline asm string:
'add$(l$) $($1,$0 $(#dst last$)$|$0,$1$)'
clang-3.9: error: clang frontend command failed with exit code 70 (use -v to
see invocation)
clang version 3.9.0 (tags/RELEASE_390/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/opt/gcc-explorer/clang+llvm-3.9.0-x86_64-linux-gnu-ubuntu-16.04/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.9: note: diagnostic msg:

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /tmp/example-9ae93d.cpp
clang-3.9: note: diagnostic msg: /tmp/example-9ae93d.sh
clang-3.9: note: diagnostic msg:

Compiler exited with result code 70

-- 
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 30309] [KNL] Wrong instruction generated in while-condition

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=30309

Zvi Rackover  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

-- 
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 31172] New: [inline asm] _asm not supported - ms compatibilty

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31172

Bug ID: 31172
   Summary: [inline asm] _asm not supported - ms compatibilty
   Product: new-bugs
   Version: unspecified
  Hardware: PC
OS: Windows NT
Status: NEW
  Severity: normal
  Priority: P
 Component: new bugs
  Assignee: unassignedb...@nondot.org
  Reporter: ziv.iz...@intel.com
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

The following code, does not compile in clang, however, it does compile in
visual studio (and in icc aswell):

int main(){
  _asm {mov eax,ebx}
  return 0;
}

with __asm, it does work.

the error:
:2:3: error: use of undeclared identifier '_asm'
_asm {mov eax,ebx}
^
1 error generated.
Compiler exited with result code 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 31173] New: Crash for alpha.core.CastToStruct

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31173

Bug ID: 31173
   Summary: Crash for alpha.core.CastToStruct
   Product: clang
   Version: trunk
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P
 Component: Static Analyzer
  Assignee: kreme...@apple.com
  Reporter: abramo.bagn...@bugseng.com
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

The checker crashes badly:

$ cat q.c

struct s {
  int v;
} x;

int main() {
  struct t* p = (struct t*) &x;
}
$ clang-4.0 -cc1 -analyze -analyzer-checker=alpha.core.CastToStruct q.c
0  libLLVM-4.0.so.1 0x7fb1da6941d8
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 56
1  libLLVM-4.0.so.1 0x7fb1da69234e llvm::sys::RunSignalHandlers() + 62
2  libLLVM-4.0.so.1 0x7fb1da69249c
3  libpthread.so.0  0x7fb1dce0b3e0
4  clang-4.00x017e5d0e
clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const + 1214
5  clang-4.00x016a96aa
clang::ASTContext::getTypeInfoImpl(clang::Type const*) const + 586
6  clang-4.00x016a096c
clang::ASTContext::getTypeInfo(clang::Type const*) const + 172
7  clang-4.00x0075ab3e
8  clang-4.00x0075d496
9  clang-4.00x014e9eb7
10 clang-4.00x014ea6d3
11 clang-4.00x014e726c
12 clang-4.00x014e8d10
13 clang-4.00x014ea6d3
14 clang-4.00x014ec147
15 clang-4.00x014e720b
16 clang-4.00x014ec253
17 clang-4.00x01564775
clang::ento::CheckerManager::runCheckersOnASTBody(clang::Decl const*,
clang::ento::AnalysisManager&, clang::ento::BugReporter&) + 101
18 clang-4.00x00d1268e
19 clang-4.00x00d182d3
20 clang-4.00x00d13402
21 clang-4.00x00d1a8c7
22 clang-4.00x00d203c8 clang::ParseAST(clang::Sema&, bool,
bool) + 792
23 clang-4.00x00ae6d9e clang::FrontendAction::Execute() + 286
24 clang-4.00x00ab8076
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 310
25 clang-4.00x00b63cc2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2514
26 clang-4.00x007a23a8 cc1_main(llvm::ArrayRef,
char const*, void*) + 2392
27 clang-4.00x00793ebe main + 7182
28 libc.so.60x7fb1d9135830 __libc_start_main + 240
29 clang-4.00x007a0749 _start + 41
Stack dump:
0.Program arguments: clang-4.0 -cc1 -analyze
-analyzer-checker=alpha.core.CastToStruct q.c 
1. parser at end of file

-- 
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 30261] [Meta] 3.9.1 Merges and Bug Fixes

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=30261

Bug 30261 depends on bug 29087, which changed state.

Bug 29087 Summary: Assertion `isa(Val) && "cast() argument of 
incompatible type!"' failed from EvaluateUnaryTypeTrait in 
lib/Sema/SemaExprCXX.cpp
https://llvm.org/bugs/show_bug.cgi?id=29087

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

-- 
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 29087] Assertion `isa(Val) && "cast() argument of incompatible type!"' failed from EvaluateUnaryTypeTrait in lib/Sema/SemaExprCXX.cpp

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=29087

Hal Finkel  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #11 from Hal Finkel  ---
Richard approved the patch for trunk and 3.9 on the 23rd. I committed it in
r287999.

-- 
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 31174] New: Merge r287999 into 3.9.x branch

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31174

Bug ID: 31174
   Summary: Merge r287999 into 3.9.x branch
   Product: clang
   Version: unspecified
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P
 Component: C++11
  Assignee: unassignedclangb...@nondot.org
  Reporter: hfin...@anl.gov
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
Classification: Unclassified

r287999 fixes PR29087, a Clang bug which affects our ability to compile the
Boost libraries. Richard approved the patch for trunk and 3.9 on the 23rd:
https://reviews.llvm.org/D23765

-- 
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 31170] [AARCH64] SIMD instructions are emitted without proper address alignment

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31170

Sergio Moreira  changed:

   What|Removed |Added

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

--- Comment #1 from Sergio Moreira  ---
I found that there's a "-mno-unaligned-access" which stops unaligned SIMD
accesses. I guess this bug can be closed now.

-- 
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 26519] Clang 3.8.0's "Target: powerpc-unknown-freebsd11.0" code generation is violating the SVR4 ABI (SEGV can result)

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=26519

Mark Millard  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #15 from Mark Millard  ---
(In reply to comment #14)

My interpretation of this is that the "lwz r30,24(r1)" is simply out
of sequence and should be later in the sequence:

> 0x0181b01c <__floatdidf+80>:  lwz r30,24(r1)  <<<=== not here
> 0x0181b020 <__floatdidf+84>:  lfs f2,0(r3)
> 0x0181b024 <__floatdidf+88>:  lwz r3,-12(r30)
> 0x0181b028 <__floatdidf+92>:  lfs f0,0(r6)
> 0x0181b02c <__floatdidf+96>:  lfs f12,0(r3)
> 0x0181b030 <__floatdidf+100>: fsubf0,f1,f0
> 0x0181b034 <__floatdidf+104>: fmulf0,f0,f2
> 0x0181b038 <__floatdidf+108>: faddf0,f0,f12
> 0x0181b03c <__floatdidf+112>: faddf1,f13,f0
lwz r30,24(r1)  <<=== instead here
> 0x0181b040 <__floatdidf+116>: addir1,r1,32
> 0x0181b044 <__floatdidf+120>: mtlrr0
> 0x0181b048 <__floatdidf+124>: blr

(addresses not adjusted for the change in the above)

So that r30 would be restored between the main activity being
finished and r1 being adjusted (popping the stack frame). Of
course any place after the last local r30 use [after -12(r30)]
up to where I show it would also work.

I reported this issue as a comment on 26519 because I'm guessing
that the ordering problem is tied to trying to trying to avoid the
stack-handling ABI violations for FreeBSD: another incompleteness
in the coverage of the stack handling. If it is not that then a
separate submittal would likely be appropriate.

Since I'm allowed to I'm going to change the status to reopened so
that it does not look to have been fully fixed. Let me know if this
is inappropriate since I would not be the one fixing it.

-- 
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 25780] [META] Using Clang as the FreeBSD/ppc system compiler

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=25780

Bug 25780 depends on bug 26519, which changed state.

Bug 26519 Summary: Clang 3.8.0's "Target: powerpc-unknown-freebsd11.0" code 
generation is violating the SVR4 ABI (SEGV can result)
https://llvm.org/bugs/show_bug.cgi?id=26519

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

-- 
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 31175] New: [AArch64] unnecessary cmp instruction with subtract and conditional select

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31175

Bug ID: 31175
   Summary: [AArch64] unnecessary cmp instruction with subtract
and conditional select
   Product: libraries
   Version: trunk
  Hardware: PC
OS: All
Status: NEW
  Severity: normal
  Priority: P
 Component: Common Code Generator Code
  Assignee: unassignedb...@nondot.org
  Reporter: spatel+l...@rotateright.com
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

; ret = (x-y) > 0 ? x-y : 0
define i32 @max(i32 %x, i32 %y) {
  %sub = sub nsw i32 %x, %y
  %cmp = icmp sgt i32 %sub, 0
  %sel = select i1 %cmp, i32 %sub, i32 0
  ret i32 %sel
}


Using AArch64 as the target because that shows the problem, but this is likely
a bug for any target that has a subtract that sets comparison flags:

$ ./llc -o - max.ll -mtriple=aarch64 
subw8, w0, w1  <--- could have used 'subs'
cmpw8, #0  <--- and eliminated this cmp
cselw0, w8, wzr, gt
ret


This IR equivalent shows the better codegen:

define i32 @max_better(i32 %x, i32 %y) {
  %sub = sub nsw i32 %x, %y
  %cmp = icmp sgt i32 %x, %y
  %sel = select i1 %cmp, i32 %sub, i32 0
  ret i32 %sel
}

$ ./llc -o - max.ll -mtriple=aarch64
subsw8, w0, w1
cselw0, w8, wzr, gt
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 31176] New: [PowerPC] could have used a CR-setting subtract

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31176

Bug ID: 31176
   Summary: [PowerPC] could have used a CR-setting subtract
   Product: libraries
   Version: trunk
  Hardware: PC
OS: All
Status: NEW
  Severity: normal
  Priority: P
 Component: Backend: PowerPC
  Assignee: unassignedb...@nondot.org
  Reporter: spatel+l...@rotateright.com
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

; ret = x > y ? x-y : 0
define i32 @max(i32 %x, i32 %y) {
  %sub = sub nsw i32 %x, %y
  %cmp = icmp sgt i32 %x, %y
  %sel = select i1 %cmp, i32 %sub, i32 0
  ret i32 %sel
}

$ ./llc -o - max.ll -mtriple=powerpc64 -mattr=isel
subf 5, 4, 3<--- use "subf."
cmpw 0, 3, 4<--- and eliminate this cmp
li 3, 0
isel 3, 5, 3, 1
blr


There's a 2nd potential bug in this example: the 'li' could be removed because
isel RT,RA,RB,BC with RA=0 treats r0 as a zero operand?

-- 
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 30934] YAML error not reported by ``yaml::Input::error()``

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=30934

Mehdi Amini  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Mehdi Amini  ---
r288014

-- 
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 31177] New: PowerPC: soft-float commit breaks Linux kernel build

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31177

Bug ID: 31177
   Summary: PowerPC: soft-float commit breaks Linux kernel build
   Product: libraries
   Version: trunk
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P
 Component: Backend: PowerPC
  Assignee: unassignedb...@nondot.org
  Reporter: an...@samba.org
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

The recent patch to enable soft-float support on PPC64 ("[PowerPC] Refactor
soft-float support, and enable PPC64 soft float") has broken Linux kernel
builds.

We want to avoid floating point in the kernel, but certain files want to be
built with vectorisation. One example is arch/powerpc/lib/xor_vmx.c.

The command line on these files contains the somewhat convoluted:

-msoft-float -mno-altivec -mno-vsx -maltivec -mabi=altivec

There are only two files in the kernel that use altivec in C, so perhaps we can
come up with a way to solve this in the kernel.

-- 
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 31178] New: Can't test for __builtin_offsetof

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31178

Bug ID: 31178
   Summary: Can't test for __builtin_offsetof
   Product: clang
   Version: 3.9
  Hardware: PC
OS: All
Status: NEW
  Severity: normal
  Priority: P
 Component: C++
  Assignee: unassignedclangb...@nondot.org
  Reporter: sits...@yahoo.com
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
Classification: Unclassified

Description of the problem:
It's not possible to test for __builtin_offsetof using __has_builtin.

Steps to reproduce:
1. Create check_offsetof.c:
#include 
#include 

#ifndef __has_builtin // Optional of course.
#define __has_builtin(x) 0// Compatibility with non-clang compilers.
#endif

struct my_struct {
long long a;
int b;
};

int main(void) {
#if __has_builtin(__builtin_offsetof)
printf("Has __builtin_offsetof\n");
#else
printf("Does NOT have __builtin_offsetof\n");
#endif

printf("__builtin_offsetof(struct my_struct, b): %lu\n",
__builtin_offsetof(struct my_struct, b));
return 0;
}
2. Compile with
clang check_offsetof.c -o check_offsetof
3. Run
./check_offsetof

Expected result:
Compilation error at 2 or output like
Has __builtin_offsetof
__builtin_offsetof(struct my_struct, b): 8

Actual result:
Output like
Does NOT have __builtin_offsetof
__builtin_offsetof(struct my_struct, b): 8

Additional information:
http://clang.llvm.org/docs/LanguageExtensions.html#has-builtin suggests it
should be possible to use __has_builtin to test for a builtin and this works
for things like __builtin_trap just not __builtin_offsetof.

Version information:
clang version 3.9.0 (branches/release_39 280336)
Target: x86_64-unknown-linux-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 31179] New: wrong code with "opt -loop-rotate -gvn -jump-threading -instcombine -lcssa -loop-vectorize -lcssa -loop-unroll -instcombine"

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31179

Bug ID: 31179
   Summary: wrong code with "opt -loop-rotate -gvn -jump-threading
-instcombine -lcssa -loop-vectorize -lcssa
-loop-unroll -instcombine"
   Product: libraries
   Version: trunk
  Hardware: PC
OS: All
Status: NEW
  Severity: normal
  Priority: P
 Component: Scalar Optimizations
  Assignee: unassignedb...@nondot.org
  Reporter: s...@cs.ucdavis.edu
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

$ clang -v
clang version 4.0.0 (trunk 287975)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clang -c -emit-llvm -o small.bc small.c
$ opt -loop-rotate -gvn -jump-threading -instcombine -lcssa -loop-vectorize
-lcssa -loop-unroll -instcombine -o small-opt.bc small.bc
$ llc -o small.s small-opt.bc
$ gcc small.s
$ ./a.out
Floating point exception (core dumped)
$ 
$ clang -O0 small.c
$ ./a.out
$ 


---


int printf (const char *, ...);

int a[128], b, e, g;
short c, d;

int main ()
{
  int f = 0, h = 5;
  for (; f < 128; f++)
a[f] = f;
L:
  c = b / h;
  e = d;
  if (d)
h = 0;
  if (d < g)
{
  printf ("%d\n", d);
  goto L;
}
  return 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 31180] New: wrong code with "opt -gvn-hoist -load-combine"

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31180

Bug ID: 31180
   Summary: wrong code with "opt -gvn-hoist -load-combine"
   Product: libraries
   Version: trunk
  Hardware: PC
OS: All
Status: NEW
  Severity: normal
  Priority: P
 Component: Scalar Optimizations
  Assignee: unassignedb...@nondot.org
  Reporter: s...@cs.ucdavis.edu
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

$ clang -v
clang version 4.0.0 (trunk 287975)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clang -c -emit-llvm -o small.bc small.c
$ opt -gvn-hoist -load-combine -o small-opt.bc small.bc
$ llc -o small.s small-opt.bc
$ gcc small.s
$ ./a.out
Floating point exception (core dumped)
$ 
$ clang -O0 small.c 
$ ./a.out
$ 


--


struct S
{
  int b;
  int c;
  int d;
} e = { 20, 0, 0 };

int f, g;

int main ()
{
  struct S h = e;
  for (; f < 4; f++)
{
  g = 0 % h.b;
  h.c = ~h.d;
  h.b = h.c;
}
  return 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 31181] New: wrong code with "opt -instcombine -early-cse -jump-threading -correlated-propagation -loop-rotate -indvars -gvn"

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31181

Bug ID: 31181
   Summary: wrong code with "opt -instcombine -early-cse
-jump-threading -correlated-propagation -loop-rotate
-indvars -gvn"
   Product: libraries
   Version: trunk
  Hardware: PC
OS: All
Status: NEW
  Severity: normal
  Priority: P
 Component: Scalar Optimizations
  Assignee: unassignedb...@nondot.org
  Reporter: s...@cs.ucdavis.edu
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

$ clang -v
clang version 4.0.0 (trunk 287975)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang -c -emit-llvm -o small.bc small.c
$ opt -instcombine -early-cse -jump-threading -correlated-propagation
-loop-rotate -indvars -gvn -o small-opt.bc small.bc
$ llc -o small.s small-opt.bc
$ gcc small.s
$ timeout -s 9 10 ./a.out
Killed
$
$ clang -O0 small.c
$ ./a.out
$


---


int a;

int main ()
{ 
  for (a = -2; a < -1; a++)
;
  return 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 31182] New: wrong code with "opt -sroa -loop-rotate -loop-unroll -simplifycfg -lcssa -loop-vectorize -lcssa -loop-unroll -instcombine"

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31182

Bug ID: 31182
   Summary: wrong code with "opt -sroa -loop-rotate -loop-unroll
-simplifycfg -lcssa -loop-vectorize -lcssa
-loop-unroll -instcombine"
   Product: libraries
   Version: trunk
  Hardware: PC
OS: All
Status: NEW
  Severity: normal
  Priority: P
 Component: Scalar Optimizations
  Assignee: unassignedb...@nondot.org
  Reporter: s...@cs.ucdavis.edu
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

$ clang -v
clang version 4.0.0 (trunk 287975)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clang -c -emit-llvm -o small.bc small.c
$ opt -sroa -loop-rotate -loop-unroll -simplifycfg -lcssa -loop-vectorize
-lcssa -loop-unroll -instcombine -o small-opt.bc small.bc
$ llc -o small.s small-opt.bc
$ gcc small.s
$ ./a.out
$ 
$ 
$ clang -O0 small.c
$ ./a.out
0
$ 


-


int printf (const char *, ...);

int a, b, c;

int fn1 ()
{
  if (c)
printf ("0\n");
  return b;
}

int main ()
{
  int d = 1, e = 0;
  for (; e < 128; e++)
;
L:
  if (fn1 ())
{
  d = 0;
  goto L;
}
  if (d)
printf ("0\n");
  return 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 31183] New: opt crashes with "opt -sroa -lcssa -licm": Assertion `InLCSSA && "Requested to preserve LCSSA, but it's already broken."' failed

2016-11-27 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31183

Bug ID: 31183
   Summary: opt crashes with "opt -sroa -lcssa -licm": Assertion
`InLCSSA && "Requested to preserve LCSSA, but it's
already broken."' failed
   Product: libraries
   Version: trunk
  Hardware: PC
OS: All
Status: NEW
  Severity: normal
  Priority: P
 Component: Scalar Optimizations
  Assignee: unassignedb...@nondot.org
  Reporter: s...@cs.ucdavis.edu
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

$ clang -v
clang version 4.0.0 (trunk 287975)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang -c -emit-llvm -w -o small.bc small.c
$ opt -sroa -lcssa -licm -o small-opt.bc small.bc
opt:
/tmp/llvm-builder/llvm-source-trunk/lib/Transforms/Utils/LoopSimplify.cpp:823:
virtual bool {anonymous}::LoopSimplify::runOnFunction(llvm::Function&):
Assertion `InLCSSA && "Requested to preserve LCSSA, but it's already broken."'
failed.
#0 0x01c45a45 (opt+0x1c45a45)
#1 0x01c43b2e (opt+0x1c43b2e)
#2 0x01c43c90 (opt+0x1c43c90)
#3 0x7fa431ad5330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x7fa4308c1c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x7fa4308c5028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x7fa4308babf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#7 0x7fa4308baca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x01cbac57 (opt+0x1cbac57)
#9 0x017dfe83 (opt+0x17dfe83)
#10 0x017dff2c (opt+0x17dff2c)
#11 0x017e0bda (opt+0x17e0bda)
#12 0x0078c9a1 (opt+0x78c9a1)
#13 0x7fa4308acf45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#14 0x007e6f4b (opt+0x7e6f4b)
Stack dump:
0.  Program arguments: opt -sroa -lcssa -licm -o small-opt.bc small.bc
1.  Running pass 'Function Pass Manager' on module 'small.bc'.
2.  Running pass 'Canonicalize natural loops' on function '@fn1'
Aborted (core dumped)
$
$


-


#include 

char a;

void fn1 ()
{ 
  int c = 0;
  for (; c < 1; c++)
while (0)
  while (1)
while (0)
  { 
if (a)
  { 
if (a)
  for (; 0; assert (c))
;
break;
  }
for (; 0; 1)
  assert (0);
  }
}

int main ()
{ 
  fn1 ();
  return 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