Bug 226658 - devel/gdb: clang 6 crashes during gdb 8.1 build (-fstrict-aliasing)
Summary: devel/gdb: clang 6 crashes during gdb 8.1 build (-fstrict-aliasing)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Luca Pizzamiglio
URL:
Keywords: toolchain
Depends on:
Blocks: 224669
  Show dependency treegraph
 
Reported: 2018-03-16 15:15 UTC by Jan Beich
Modified: 2018-10-31 18:49 UTC (History)
1 user (show)

See Also:
pizzamig: maintainer-feedback+


Attachments
gdb/minsyms.c (compressed, preprocessed) (546.01 KB, application/x-xz)
2018-03-16 15:16 UTC, Jan Beich
no flags Details
command line args (for clang 6.0) (3.83 KB, text/plain)
2018-03-16 15:17 UTC, Jan Beich
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2018-03-16 15:15:12 UTC
$ env WITHOUT_NO_STRICT_ALIASING=1 make clean all BATCH=
[...]
c++ -x c++  -O2 -pipe -DRL_NO_COMPAT -Wno-unused-function -Wno-unused-variable -Wno-unknown-warning-option -DLIBICONV_PLUG -Wno-extended-offsetof -fstack-protector  -DLIBICONV_PLUG   -I. -I. -I./common -I./config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/..  -I./../zlib -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  -I./gnulib/import -Ibuild-gnulib/import   -DTUI=1  -DLIBICONV_PLUG -I/usr/local/include  -I/usr/local/include/python2.7 -I/usr/local/include/python2.7 -Wall -Wpointer-arith -Wno-unused -Wno-switch -Wno-char-subscripts -Wempty-body -Wno-sign-compare -Wno-narrowing -Wno-mismatched-tags -Wformat-nonliteral  -c -o minsyms.o -MT minsyms.o -MMD -MP -MF ./.deps/minsyms.Tpo minsyms.c
Did not see access type in access path!
  %41 = load i8*, i8** %object_base, align 8, !tbaa !109
!109 = !{!77, !8, i64 16}
Did not see access type in access path!
  %83 = load i8*, i8** %next_free57, align 8, !tbaa !113
!113 = !{!77, !8, i64 24}
Did not see access type in access path!
  store i8* %add.ptr58, i8** %next_free57, align 8, !tbaa !113
!113 = !{!77, !8, i64 24}
fatal error: error in backend: Broken function found, compilation aborted!
c++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
FreeBSD clang version 6.0.0 (tags/RELEASE_600/final 326565) (based on LLVM 6.0.0)
Target: x86_64-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/bin
Comment 1 Jan Beich freebsd_committer 2018-03-16 15:16:45 UTC
Created attachment 191550 [details]
gdb/minsyms.c (compressed, preprocessed)
Comment 2 Jan Beich freebsd_committer 2018-03-16 15:17:14 UTC
Created attachment 191551 [details]
command line args (for clang 6.0)
Comment 3 Luca Pizzamiglio freebsd_committer 2018-03-16 15:38:02 UTC
Using the following command line:

$ env WITHOUT_NO_STRICT_ALIASING=1 make stage

I'm not able to reproduce the error.
But my CURRENT is not 100% up-to-date (1200058)

clang --version
FreeBSD clang version 6.0.0 (branches/release_60 325932) (based on LLVM 6.0.0)
Target: x86_64-unknown-freebsd12.0

You're building gdb 8.1_1, right?
Comment 4 Jan Beich freebsd_committer 2018-03-16 16:00:02 UTC
(In reply to Luca Pizzamiglio from comment #3)
> I'm not able to reproduce the error.

If unsure better use the files Clang generated on crash:

$ fetch -o minsyms-4cd1ed.cpp.xz 'https://bugs.freebsd.org/bugzilla/attachment.cgi?id=191550'
$ fetch -o minsyms-4cd1ed.sh 'https://bugs.freebsd.org/bugzilla/attachment.cgi?id=191551'
$ xz -d minsyms-4cd1ed.cpp.xz
$ sh minsyms-4cd1ed.sh

(In reply to Luca Pizzamiglio from comment #3)
> You're building gdb 8.1_1, right?

Yes. Clang 6 didn't crash before ports r464493. I've also ruled out ports r464688 by testing with -Wno-narrowing.
Comment 5 Dimitry Andric freebsd_committer 2018-03-16 18:01:59 UTC
Upstream bug: https://bugs.llvm.org/show_bug.cgi?id=35724
Upstream fix: https://reviews.llvm.org/rL321999

I will check the upstream fix, and import it into clang 6.0.0 in head.
Comment 6 commit-hook freebsd_committer 2018-03-16 18:05:02 UTC
A commit references this bug:

Author: dim
Date: Fri Mar 16 18:04:14 UTC 2018
New revision: 331066
URL: https://svnweb.freebsd.org/changeset/base/331066

Log:
  Pull in r321999 from upstream clang trunk (by Ivan A. Kosarev):

    [CodeGen] Fix TBAA info for accesses to members of base classes

    Resolves:
    Bug 35724 - regression (r315984): fatal error: error in backend:
    Broken function found (Did not see access type in access path!)
    https://bugs.llvm.org/show_bug.cgi?id=35724

    Differential Revision: https://reviews.llvm.org/D41547

  This fixes "Did not see access type in access path" fatal errors when
  building the devel/gdb port (version 8.1).

  Reported by:	jbeich
  PR:		226658
  MFC after:	3 months
  X-MFC-With:	r327952

Changes:
  head/contrib/llvm/tools/clang/lib/CodeGen/CGExpr.cpp
Comment 7 commit-hook freebsd_committer 2018-10-26 21:20:31 UTC
A commit references this bug:

Author: dim
Date: Fri Oct 26 21:20:06 UTC 2018
New revision: 483054
URL: https://svnweb.freebsd.org/changeset/ports/483054

Log:
  Add all patches from base llvm/clang/lld/lldb 6.0 to devel/llvm60

  This adds all the patches that were applied in the past to head, under
  contrib/llvm.  After these, there only minimal diffs left between the
  port sources and the base sources.

  Most of these remaining diffs are due to #ifdef shortcuts in the base
  sources, because we don't compile certain features in.  Other diffs are
  because the port has applied a few changes that we don't have in base.

  While here, use Makefile.LICENSE from the devel/llvm-devel port.

  Approved by:	brooks (maintainer)
  Reviewed by:	brooks
  PR:		212343, 225128, 225471, 226388, 226658, 226872, 229050, 230444, 230604, 231355
  MFH:		2018Q4
  Differential Revision: https://reviews.freebsd.org/D17702

Changes:
  head/devel/llvm60/Makefile
  head/devel/llvm60/files/clang/patch-head-r331066.diff
  head/devel/llvm60/files/clang/patch-head-r336227.diff
  head/devel/llvm60/files/clang/patch-head-r338697.diff
  head/devel/llvm60/files/clang/patch-head-r339019.diff
  head/devel/llvm60/files/lld/
  head/devel/llvm60/files/lld/patch-head-r331731.diff
  head/devel/llvm60/files/lld/patch-head-r333401.diff
  head/devel/llvm60/files/lld/patch-head-r336664.diff
  head/devel/llvm60/files/lld/patch-head-r336972.diff
  head/devel/llvm60/files/lld/patch-head-r337282.diff
  head/devel/llvm60/files/lld/patch-head-r338251.diff
  head/devel/llvm60/files/lld/patch-head-r338682.diff
  head/devel/llvm60/files/lld/patch-head-r339013.diff
  head/devel/llvm60/files/lld/patch-head-r339304.diff
  head/devel/llvm60/files/lldb/
  head/devel/llvm60/files/lldb/patch-head-r332849.diff
  head/devel/llvm60/files/lldb/patch-head-r332965.diff
  head/devel/llvm60/files/patch-head-r308867.diff
  head/devel/llvm60/files/patch-head-r330686.diff
  head/devel/llvm60/files/patch-head-r331065.diff
  head/devel/llvm60/files/patch-head-r331366.diff
  head/devel/llvm60/files/patch-head-r336969.diff
  head/devel/llvm60/files/patch-head-r336970.diff
  head/devel/llvm60/files/patch-head-r337615.diff
  head/devel/llvm60/files/patch-head-r338689.diff
Comment 8 commit-hook freebsd_committer 2018-10-31 18:49:40 UTC
A commit references this bug:

Author: dim
Date: Wed Oct 31 18:49:07 UTC 2018
New revision: 483602
URL: https://svnweb.freebsd.org/changeset/ports/483602

Log:
  MFH: r481120

  Update to a new snapshot.

  Update LICENSE data per mailing list feedback and move to a seperate
  Makefile.LICENSE for use by other llvm ports.

  MFH: r483054

  Add all patches from base llvm/clang/lld/lldb 6.0 to devel/llvm60

  This adds all the patches that were applied in the past to head, under
  contrib/llvm.  After these, there only minimal diffs left between the
  port sources and the base sources.

  Most of these remaining diffs are due to #ifdef shortcuts in the base
  sources, because we don't compile certain features in.  Other diffs are
  because the port has applied a few changes that we don't have in base.

  While here, use Makefile.LICENSE from the devel/llvm-devel port.

  Approved by:	portmgr (miwi)
  Reviewed by:	brooks
  PR:		212343, 225128, 225471, 226388, 226658, 226872, 229050, 230444, 230604, 231355
  Differential Revision: https://reviews.freebsd.org/D17702

Changes:
_U  branches/2018Q4/
  branches/2018Q4/devel/llvm-devel/Makefile
  branches/2018Q4/devel/llvm-devel/Makefile.LICENSE
  branches/2018Q4/devel/llvm-devel/Makefile.snapshot
  branches/2018Q4/devel/llvm-devel/distinfo
  branches/2018Q4/devel/llvm-devel/files/lldb-patch-tools_lldb_source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp
  branches/2018Q4/devel/llvm-devel/pkg-plist
  branches/2018Q4/devel/llvm60/Makefile
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r331066.diff
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r336227.diff
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r338697.diff
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r339019.diff
  branches/2018Q4/devel/llvm60/files/lld/
  branches/2018Q4/devel/llvm60/files/lldb/
  branches/2018Q4/devel/llvm60/files/patch-head-r308867.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r330686.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r331065.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r331366.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r336969.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r336970.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r337615.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r338689.diff