Bug 176967

Summary: editors/libreoffice crashes
Product: Ports & Packages Reporter: understudy
Component: Individual Port(s)Assignee: FreeBSD Office Team <office>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
libreoffice4-gcc-default.diff none

Description understudy 2013-03-14 19:30:00 UTC
After a recent portupgrade of libreoffice to version 4.0.1. Any attempt to open libreoffice results in a complete crash of the libreoffice software. 

Libreoffice core dump

Information below

System information

FreeBSD Shibari.brendhanhorne.com 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243826: Tue Dec  4 06:55:39 UTC 2012 root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

Program information

libreoffice-4.0.1   Full integrated office productivity suite

Dump information

[bhorne@Shibari:~, 11:51 PM, Wed Mar 13]>gdb soffice.bin
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...soffice.bin: No such file or directory.

(gdb) core soffice.bin.core
Core was generated by `soffice.bin'.
Program terminated with signal 11, Segmentation fault.
#0  0x2e9de280 in ?? ()
(gdb) quit
[1]+  Exit 139                libreoffice

Ports tree is up to date as March 14, 2013

Sincerely,

Brendhan

How-To-Repeat: open libreoffice
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-03-16 07:04:17 UTC
Responsible Changed
From-To: freebsd-ports-bugs->office

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Dwayne MacKinnon 2013-03-18 14:38:02 UTC
Hi,

I maintain two 9.1-RELEASE i386 & one 9.1-RELEASE amd64 boxes. This problem 
appears to be specific to i386. It appears on both of those boxes and does not 
appear on my amd64 box.

Cheers,
DMK
Comment 3 understudy 2013-03-18 14:49:09 UTC
On 03/18/13 10:38, Dwayne MacKinnon wrote:
> Hi,
>
> I maintain two 9.1-RELEASE i386 & one 9.1-RELEASE amd64 boxes. This problem
> appears to be specific to i386. It appears on both of those boxes and does not
> appear on my amd64 box.
>
> Cheers,
> DMK
Thank you . I hope this gets a look at.

Sincerely,

Brendhan
Comment 4 understudy 2013-03-18 14:53:57 UTC
On 03/18/13 10:38, Dwayne MacKinnon wrote:
> Hi,
>
> I maintain two 9.1-RELEASE i386 & one 9.1-RELEASE amd64 boxes. This problem
> appears to be specific to i386. It appears on both of those boxes and does not
> appear on my amd64 box.
>
> Cheers,
> DMK
Thank you . I hope this gets a look at.

Sincerely,

Brendhan
Comment 5 Carlos J Puga Medina 2013-03-23 16:02:27 UTC
Finally, I solved this issue just by modifying
/usr/ports/editors/libreoffice/Makefile to build with debug symbols
(enabled DEBUG option) as following:

.if ${PORT_OPTIONS:MDEBUG}
#IGNORE=                known as broken
CONFIGURE_ARGS+=        --enable-debug \
#                       --enable-dbgutil \
#                       --enable-verbose \
#                       --enable-crashdump
.else

Builded with Clang on FreeBSD-9.1/i386. I detect LO still running after
close it, so is necessary kill(1) process 'ossplash --writer' to free
memory.

% ps x | grep libreoffice
58379 v0  I    0:00,84 /usr/local/lib/libreoffice/program/oosplash --writer
58390 v0  S    0:08,22 /usr/local/lib/libreoffice/program/soffice.bin
--writer
58393  0  S+   0:00,00 grep libreoffice
Comment 6 understudy 2013-03-24 13:02:33 UTC
On 03/23/13 12:02, Carlos Jacobo Puga Medina wrote:
> Finally, I solved this issue just by modifying 
> /usr/ports/editors/libreoffice/Makefile to build with debug symbols 
> (enabled DEBUG option) as following:
>
> .if ${PORT_OPTIONS:MDEBUG}
> #IGNORE=                known as broken
> CONFIGURE_ARGS+=        --enable-debug \
> #                       --enable-dbgutil \
> #                       --enable-verbose \
> #                       --enable-crashdump
> .else
>
> Builded with Clang on FreeBSD-9.1/i386. I detect LO still running 
> after close it, so is necessary kill(1) process 'ossplash --writer' to 
> free memory.
>
> % ps x | grep libreoffice
> 58379 v0  I    0:00,84 /usr/local/lib/libreoffice/program/oosplash 
> --writer
> 58390 v0  S    0:08,22 /usr/local/lib/libreoffice/program/soffice.bin 
> --writer
> 58393  0  S+   0:00,00 grep libreoffice

My results were different. It did not open but it did not core dump. 
Here is my modified Makefile

lines 205-211
.if ${PORT_OPTIONS:MDEBUG}
#IGNORE=                        known as broken
CONFIGURE_ARGS+=        --enable-debug \
#                       --enable-dbgutil \
#                       --enable-verbose \
#                       --enable-crashdump
.else

line 299
#BROKEN=                mergelibs causes runtime problems

#make config
uncheck MERGELIBS

When it did run I got the splash screen and then nothing.

[bhorne@Shibari:~, 08:48 AM, Sun Mar 24]>ps x | grep libreoffice
  7299 p2  I     0:00.07 /usr/local/lib/libreoffice/program/oosplash
  7310 p2  I     0:02.60 /usr/local/lib/libreoffice/program/soffice.bin 
--splash
  7331 p2  S+    0:00.00 grep libreoffice


So it is running but after a while no changes. So I killed the process.

libreoffice does not accept a verbose or -vv switch from what I can tell.

If there is something else I can do let me know.

Sincerely,

Brendhan
Comment 7 lumiwa 2013-03-24 13:24:53 UTC
My problem is different too because LibreOffice dosn't start:

> gdb /usr/local/lib/libreoffice/program/soffice.bin soffice.bin.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...(no debugging symbols 
found)...
Core was generated by `soffice.bin'.
Program terminated with signal 11, Segmentation fault.
***
***
#0  0x2e602010 in XFree@plt () from 
/usr/local/lib/libreoffice/program/libvclplug_genlo.so
[New Thread 2c804c00 (LWP 100451/soffice.bin)]
[New Thread 2c804300 (LWP 100539/soffice.bin)]
(gdb) 

Mitja
----------
http://www.redbubble.com/people/lumiwa
Comment 8 Carlos J Puga Medina 2013-03-24 13:46:53 UTC
Try with this configuration options:

===> The following configuration options are available for
libreoffice-4.0.1_1:
     CUPS=on: CUPS printing system support
     DEBUG=on: Install debug symbols
     GNOME=off: GNOME desktop environment support
     GTK2=off: GTK+ 2 GUI toolkit support
     GTK3=off: GTK+ 3 GUI toolkit support
     JAVA=off: Add java support (XML Filters, macros)
     KDE4=off: KDE 4 desktop environment support
     MERGELIBS=off: Enable linking of big merged library
     MMEDIA=on: Enable multimedia backend for impress
     PGSQL=off: Build with PostgreSQL-SDBC driver
     SDK=off: Build with SDK
     SYSTRAY=off: Enable systemtray quickstarter
     TEST=off: Run all regression tests
     WEBDAV=off: Enable webdav protocol
===> Use 'make config' to modify these settings

You might delete old settings folder, just run:

# rm -R .config/libreoffice
Comment 9 understudy 2013-03-25 18:20:51 UTC
On 03/24/13 09:46, Carlos Jacobo Puga Medina wrote:
> Try with this configuration options:
>
> ===> The following configuration options are available for 
> libreoffice-4.0.1_1:
>      CUPS=on: CUPS printing system support
>      DEBUG=on: Install debug symbols
>      GNOME=off: GNOME desktop environment support
>      GTK2=off: GTK+ 2 GUI toolkit support
>      GTK3=off: GTK+ 3 GUI toolkit support
>      JAVA=off: Add java support (XML Filters, macros)
>      KDE4=off: KDE 4 desktop environment support
>      MERGELIBS=off: Enable linking of big merged library
>      MMEDIA=on: Enable multimedia backend for impress
>      PGSQL=off: Build with PostgreSQL-SDBC driver
>      SDK=off: Build with SDK
>      SYSTRAY=off: Enable systemtray quickstarter
>      TEST=off: Run all regression tests
>      WEBDAV=off: Enable webdav protocol
> ===> Use 'make config' to modify these settings
>
> You might delete old settings folder, just run:
>
> # rm -R .config/libreoffice
>
Hi,

libreoffice opened and functioned. A ton of messages.

[bhorne@Shibari:~, 02:12 PM, Mon Mar 25]>libreoffice &
[1] 50306
[bhorne@Shibari:~, 02:13 PM, Mon Mar 25]>I18N: Operating system doesn't 
support locale "en_US"
warn:sfx2.dialog:50317:1:/usr/ports/editors/libreoffice/work/libreoffice-4.0.1.2/sfx2/source/dialog/filtergrouping.cxx:361: 
already have an element for WordPerfect
warn:sfx2.dialog:50317:1:/usr/ports/editors/libreoffice/work/libreoffice-4.0.1.2/sfx2/source/dialog/filtergrouping.cxx:361: 
already have an element for StarWriter/Web 4.0 Vorlage/Template
warn:sfx2.dialog:50317:1:/usr/ports/editors/libreoffice/work/libreoffice-4.0.1.2/sfx2/source/dialog/filtergrouping.cxx:361: 
already have an element for StarWriter/Web 5.0 Vorlage/Template
warn:sfx2.dialog:50317:1:/usr/ports/editors/libreoffice/work/libreoffice-4.0.1.2/sfx2/source/dialog/filtergrouping.cxx:361: 
already have an element for writerweb8_writer_template
warn:sfx2.dialog:50317:1:/usr/ports/editors/libreoffice/work/libreoffice-4.0.1.2/sfx2/source/dialog/filtergrouping.cxx:361: 
already have an element for writerglobal8
warn:configmgr:50317:1:/usr/ports/editors/libreoffice/work/libreoffice-4.0.1.2/configmgr/source/propertynode.cxx:68: 
non-nillable property without value
warn:sc:50317:1:/usr/ports/editors/libreoffice/work/libreoffice-4.0.1.2/sc/source/filter/xml/xmlsubti.cxx:223: 
more columns than fit into SCCOL
warn:svx.sdr:50317:1:/usr/ports/editors/libreoffice/work/libreoffice-4.0.1.2/svx/source/svdraw/svdobj.cxx:2935: 
SdrObject::impl_setUnoShape: still having impl. pointer to dead object!
warn:sc:50317:1:/usr/ports/editors/libreoffice/work/libreoffice-4.0.1.2/sc/source/filter/xml/xmlsubti.cxx:223: 
more columns than fit into SCCOL
warn:basic:50317:1:/usr/ports/editors/libreoffice/work/libreoffice-4.0.1.2/basic/source/uno/namecont.cxx:1219: 
Upgrade of Basic installation failed somehow: "Standard" not found

[bhorne@Shibari:~, 02:15 PM, Mon Mar 25]>
[bhorne@Shibari:~, 02:17 PM, Mon Mar 25]>
[bhorne@Shibari:~, 02:17 PM, Mon Mar 25]>
[bhorne@Shibari:~, 02:17 PM, Mon Mar 25]>
[bhorne@Shibari:~, 02:17 PM, Mon Mar 25]>
[bhorne@Shibari:~, 02:17 PM, Mon Mar 25]>
[bhorne@Shibari:~, 02:17 PM, Mon Mar 25]>
[bhorne@Shibari:~, 02:17 PM, Mon Mar 25]>
[bhorne@Shibari:~, 02:17 PM, Mon Mar 25]> ps x | grep libreoffice
50306 p0  I    0:00.17 /usr/local/lib/libreoffice/program/oosplash
50317 p0  I    0:08.92 /usr/local/lib/libreoffice/program/soffice.bin 
--splash-
50352 p0  S+   0:00.00 grep libreoffice
[bhorne@Shibari:~, 02:18 PM, Mon Mar 25]>


It does not die when you close it as you can see. As was mentioned 
earlier a kill must be preformed in order to close libreoffice.

Sincerely,

Brendhan
Comment 10 Dwayne MacKinnon 2013-04-23 15:50:39 UTC
I'm sorry to say that this bug still exists for i386 in version 4.0.2.
Comment 11 Gabor Pali freebsd_committer freebsd_triage 2013-04-28 09:22:18 UTC
Hi there,

On Tue, Apr 23, 2013 at 5:10 PM, Dwayne MacKinnon <dmk@ncf.ca> wrote:
>  I'm sorry to say that this bug still exists for i386 in version 4.0.2.

Yes, I can confirm this too.  I have studied the problem and it seems
it is mainly because Clang is used for compilation.  I tried to debug
the source of the problem but it turned out that gdb(1) (not even the
recents versions of it) cannot fully debug the Clang-generated
binaries and I could not make lldb (Clang's own debugger) work on
FreeBSD, and that is not even in the Ports Collection officially.

I then discovered there is a knob, WITH_GCC that enables you to
fallback to building LibreOffice with GCC 4.6 or later.  Building with
this setting finally I was able to launch LO on my machine and it even
worked.  So I would recommend to pass this knob to the Makefile upon
build:

# make install clean BATCH=yes WITH_GCC=yes

For maintainers: Although it said that it is possible to build
LibreOffice on the TDF wiki, this applies to version 3.6.x only.  For
4.0.x, there is no such information, so I would like to ask you to
switch back to building with GCC by default.  (See a patch attached
that reverses the current logic in the port.)
Comment 12 Tijl Coosemans freebsd_committer freebsd_triage 2013-05-14 20:07:21 UTC
State Changed
From-To: open->closed

Submitter got libreoffice working. The followup reports are duplicates 
of ports/176893.
Comment 13 dfilter service freebsd_committer freebsd_triage 2013-05-22 22:53:08 UTC
Author: brooks
Date: Wed May 22 21:52:59 2013
New Revision: 318798
URL: http://svnweb.freebsd.org/changeset/ports/318798

Log:
  Apply several upstream svn revisions that have also been merged to the
  base version:
  
  r170353:
  Fix another SROA crasher, PR14601.
  
  This was a silly oversight, we weren't pruning allocas which were used
  by variable-length memory intrinsics from the set that could be widened
  and promoted as integers. Fix that.
  
  r175057:
  X86: Disable generation of rep;movsl when %esi is used as a base pointer.
  
  This happens when there is both stack realignment and a dynamic alloca in the
  function. If we overwrite %esi (rep;movsl uses fixed registers) we'll lose the
  base pointer and the next register spill will write into oblivion.
  
  Fixes PR15249 and unbreaks firefox on i386/freebsd. Mozilla uses dynamic allocas
  and freebsd a 4 byte stack alignment.
  
  r175360:
  MCParser: Reject .balign with non-pow2 alignments.
  
  GNU as rejects them and there are configure scripts in the wild that check if
  the assembler rejects ".align 3" to determine whether the alignment is in bytes
  or powers of two.
  
  r175962:
  X86: Disable cmov-memory patterns on subtargets without cmov.
  
  PR:		ports/176269, ports/176893, ports/176967
  Requested by:	tijl, dim, others

Added:
  head/devel/llvm/files/patch-svn-r170353   (contents, props changed)
  head/devel/llvm/files/patch-svn-r175057   (contents, props changed)
  head/devel/llvm/files/patch-svn-r175360   (contents, props changed)
  head/devel/llvm/files/patch-svn-r175962   (contents, props changed)
Modified:
  head/devel/llvm/Makefile

Modified: head/devel/llvm/Makefile
==============================================================================
--- head/devel/llvm/Makefile	Wed May 22 21:47:40 2013	(r318797)
+++ head/devel/llvm/Makefile	Wed May 22 21:52:59 2013	(r318798)
@@ -7,7 +7,7 @@
 
 PORTNAME=	llvm
 PORTVERSION=	3.2
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	devel lang
 MASTER_SITES=	http://llvm.org/releases/${PORTVERSION}/
 DISTNAME=	${PORTNAME}-${PORTVERSION}.src
@@ -23,7 +23,7 @@ BUILD_DEPENDS+=	bash:${PORTSDIR}/shells/
 BUILD_DEPENDS+=	f2c:${PORTSDIR}/lang/f2c
 .endif
 
-CONFLICTS=	llvm-devel-[23]* llvm29-* llvm31-*
+CONFLICTS=	llvm-devel-[23]* llvm31-3*
 
 GNU_CONFIGURE=	yes
 USE_GMAKE=	yes
@@ -165,4 +165,16 @@ build-plist:
 	    ${SED} -e 's|${DOCSDIR}|%%DOCSDIR%%|' \
 	     -e 's|^|%%PORTDOCS%%@dirrm |' >> ${PLIST}
 
+.if make(svn-patch)
+.if !defined(PATCH_REV)
+.error svn-patch requires that PATCH_REV be set
+.endif
+_PATCH_FILE=${FILESDIR}/patch-svn-${PATCH_REV}
+_LLVM_BASE=http://llvm.org/svn/llvm-project/llvm/trunk
+svn-patch:
+	printf "$$%s$$\n" FreeBSD > ${_PATCH_FILE}
+	svn log -c ${PATCH_REV} ${_LLVM_BASE} >> ${_PATCH_FILE}
+	svn diff -c ${PATCH_REV} ${_LLVM_BASE} >> ${_PATCH_FILE}
+.endif
+
 .include <bsd.port.post.mk>

Added: head/devel/llvm/files/patch-svn-r170353
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/llvm/files/patch-svn-r170353	Wed May 22 21:52:59 2013	(r318798)
@@ -0,0 +1,46 @@
+$FreeBSD$
+------------------------------------------------------------------------
+r170353 | chandlerc | 2012-12-17 18:48:07 +0000 (Mon, 17 Dec 2012) | 5 lines
+
+Fix another SROA crasher, PR14601.
+
+This was a silly oversight, we weren't pruning allocas which were used
+by variable-length memory intrinsics from the set that could be widened
+and promoted as integers. Fix that.
+------------------------------------------------------------------------
+Index: lib/Transforms/Scalar/SROA.cpp
+===================================================================
+--- lib/Transforms/Scalar/SROA.cpp	(revision 170352)
++++ lib/Transforms/Scalar/SROA.cpp	(revision 170353)
+@@ -2150,7 +2150,7 @@
+           !canConvertValue(TD, ValueTy, AllocaTy))
+         return false;
+     } else if (MemIntrinsic *MI = dyn_cast<MemIntrinsic>(I->U->getUser())) {
+-      if (MI->isVolatile())
++      if (MI->isVolatile() || !isa<Constant>(MI->getLength()))
+         return false;
+       if (MemTransferInst *MTI = dyn_cast<MemTransferInst>(I->U->getUser())) {
+         const AllocaPartitioning::MemTransferOffsets &MTO
+Index: test/Transforms/SROA/basictest.ll
+===================================================================
+--- test/Transforms/SROA/basictest.ll	(revision 170352)
++++ test/Transforms/SROA/basictest.ll	(revision 170353)
+@@ -1208,3 +1208,18 @@
+   ret i32 %y
+ ; CHECK: ret i32
+ }
++
++define i32 @PR14601(i32 %x) {
++; Don't try to form a promotable integer alloca when there is a variable length
++; memory intrinsic.
++; CHECK: @PR14601
++
++entry:
++  %a = alloca i32
++; CHECK: alloca
++
++  %a.i8 = bitcast i32* %a to i8*
++  call void @llvm.memset.p0i8.i32(i8* %a.i8, i8 0, i32 %x, i32 1, i1 false)
++  %v = load i32* %a
++  ret i32 %v
++}

Added: head/devel/llvm/files/patch-svn-r175057
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/llvm/files/patch-svn-r175057	Wed May 22 21:52:59 2013	(r318798)
@@ -0,0 +1,55 @@
+$FreeBSD$
+------------------------------------------------------------------------
+r175057 | d0k | 2013-02-13 13:40:35 +0000 (Wed, 13 Feb 2013) | 8 lines
+
+X86: Disable generation of rep;movsl when %esi is used as a base pointer.
+
+This happens when there is both stack realignment and a dynamic alloca in the
+function. If we overwrite %esi (rep;movsl uses fixed registers) we'll lose the
+base pointer and the next register spill will write into oblivion.
+
+Fixes PR15249 and unbreaks firefox on i386/freebsd. Mozilla uses dynamic allocas
+and freebsd a 4 byte stack alignment.
+------------------------------------------------------------------------
+Index: lib/Target/X86/X86SelectionDAGInfo.cpp
+===================================================================
+--- lib/Target/X86/X86SelectionDAGInfo.cpp	(revision 175056)
++++ lib/Target/X86/X86SelectionDAGInfo.cpp	(revision 175057)
+@@ -202,6 +202,14 @@
+       SrcPtrInfo.getAddrSpace() >= 256)
+     return SDValue();
+ 
++  // ESI might be used as a base pointer, in that case we can't simply overwrite
++  // the register.  Fall back to generic code.
++  const X86RegisterInfo *TRI =
++      static_cast<const X86RegisterInfo *>(DAG.getTarget().getRegisterInfo());
++  if (TRI->hasBasePointer(DAG.getMachineFunction()) &&
++      TRI->getBaseRegister() == X86::ESI)
++    return SDValue();
++
+   MVT AVT;
+   if (Align & 1)
+     AVT = MVT::i8;
+Index: test/CodeGen/X86/stack-align-memcpy.ll
+===================================================================
+--- test/CodeGen/X86/stack-align-memcpy.ll	(revision 0)
++++ test/CodeGen/X86/stack-align-memcpy.ll	(revision 175057)
+@@ -0,0 +1,18 @@
++; RUN: llc < %s -force-align-stack -mtriple i386-apple-darwin -mcpu=i486 | FileCheck %s
++
++%struct.foo = type { [88 x i8] }
++
++; PR15249
++; We can't use rep;movsl here because it clobbers the base pointer in %esi.
++define void @test1(%struct.foo* nocapture %x, i32 %y) nounwind {
++  %dynalloc = alloca i8, i32 %y, align 1
++  call void @bar(i8* %dynalloc, %struct.foo* align 4 byval %x)
++  ret void
++
++; CHECK: test1:
++; CHECK: andl $-16, %esp
++; CHECK: movl %esp, %esi
++; CHECK-NOT: rep;movsl
++}
++
++declare void @bar(i8* nocapture, %struct.foo* align 4 byval) nounwind

Added: head/devel/llvm/files/patch-svn-r175360
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/llvm/files/patch-svn-r175360	Wed May 22 21:52:59 2013	(r318798)
@@ -0,0 +1,40 @@
+$FreeBSD$
+------------------------------------------------------------------------
+r175360 | d0k | 2013-02-16 15:00:16 +0000 (Sat, 16 Feb 2013) | 5 lines
+
+MCParser: Reject .balign with non-pow2 alignments.
+
+GNU as rejects them and there are configure scripts in the wild that check if
+the assembler rejects ".align 3" to determine whether the alignment is in bytes
+or powers of two.
+------------------------------------------------------------------------
+Index: lib/MC/MCParser/AsmParser.cpp
+===================================================================
+--- lib/MC/MCParser/AsmParser.cpp	(revision 175359)
++++ lib/MC/MCParser/AsmParser.cpp	(revision 175360)
+@@ -2456,6 +2456,10 @@
+     }
+ 
+     Alignment = 1ULL << Alignment;
++  } else {
++    // Reject alignments that aren't a power of two, for gas compatibility.
++    if (!isPowerOf2_64(Alignment))
++      Error(AlignmentLoc, "alignment must be a power of 2");
+   }
+ 
+   // Diagnose non-sensical max bytes to align.
+Index: test/MC/AsmParser/align_invalid.s
+===================================================================
+--- test/MC/AsmParser/align_invalid.s	(revision 0)
++++ test/MC/AsmParser/align_invalid.s	(revision 175360)
+@@ -0,0 +1,10 @@
++# RUN: llvm-mc -triple i386-linux-gnu < %s 2>&1 | FileCheck %s -check-prefix=ELF
++# RUN: llvm-mc -triple i386-apple-darwin < %s 2>&1 | FileCheck %s -check-prefix=DARWIN
++
++.align 3
++# ELF: error: alignment must be a power of 2
++# DARWIN-NOT: error
++
++.align 32
++# ELF-NOT: error
++# DARWIN: error: invalid alignment value

Added: head/devel/llvm/files/patch-svn-r175962
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/llvm/files/patch-svn-r175962	Wed May 22 21:52:59 2013	(r318798)
@@ -0,0 +1,49 @@
+$FreeBSD$
+------------------------------------------------------------------------
+r175962 | d0k | 2013-02-23 10:40:58 +0000 (Sat, 23 Feb 2013) | 3 lines
+
+X86: Disable cmov-memory patterns on subtargets without cmov.
+
+Fixes PR15115.
+------------------------------------------------------------------------
+Index: test/CodeGen/X86/no-cmov.ll
+===================================================================
+--- test/CodeGen/X86/no-cmov.ll	(revision 0)
++++ test/CodeGen/X86/no-cmov.ll	(revision 175962)
+@@ -0,0 +1,11 @@
++; RUN: llc -march=x86 -mcpu=i486 < %s | FileCheck %s
++
++define i32 @test1(i32 %g, i32* %j) {
++  %tobool = icmp eq i32 %g, 0
++  %cmp = load i32* %j, align 4
++  %retval.0 = select i1 %tobool, i32 1, i32 %cmp
++  ret i32 %retval.0
++
++; CHECK: test1:
++; CHECK-NOT: cmov
++}
+Index: lib/Target/X86/X86InstrCompiler.td
+===================================================================
+--- lib/Target/X86/X86InstrCompiler.td	(revision 175961)
++++ lib/Target/X86/X86InstrCompiler.td	(revision 175962)
+@@ -1081,12 +1081,14 @@
+ // inverted.
+ multiclass CMOVmr<PatLeaf InvertedCond, Instruction Inst16, Instruction Inst32,
+                   Instruction Inst64> {
+-  def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, InvertedCond, EFLAGS),
+-            (Inst16 GR16:$src2, addr:$src1)>;
+-  def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, InvertedCond, EFLAGS),
+-            (Inst32 GR32:$src2, addr:$src1)>;
+-  def : Pat<(X86cmov (loadi64 addr:$src1), GR64:$src2, InvertedCond, EFLAGS),
+-            (Inst64 GR64:$src2, addr:$src1)>;
++  let Predicates = [HasCMov] in {
++    def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, InvertedCond, EFLAGS),
++              (Inst16 GR16:$src2, addr:$src1)>;
++    def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, InvertedCond, EFLAGS),
++              (Inst32 GR32:$src2, addr:$src1)>;
++    def : Pat<(X86cmov (loadi64 addr:$src1), GR64:$src2, InvertedCond, EFLAGS),
++              (Inst64 GR64:$src2, addr:$src1)>;
++  }
+ }
+ 
+ defm : CMOVmr<X86_COND_B , CMOVAE16rm, CMOVAE32rm, CMOVAE64rm>;
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"