[Bug 199186] Fix sysutils/i7z segfaults and warnings

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Apr 5 20:20:25 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199186

            Bug ID: 199186
           Summary: Fix sysutils/i7z segfaults and warnings
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: zont at FreeBSD.org
          Reporter: dim at FreeBSD.org
          Assignee: zont at FreeBSD.org
             Flags: maintainer-feedback?(zont at FreeBSD.org)

Created attachment 155215
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=155215&action=edit
Fix sysutils/i7z segfaults and warnings

I found out that sysutils/i7z segfaults under various conditions, e.g.
different compilers and compilation flags.  For example, compiling with clang
-O0 almost always works, but as soon as you start optimizing, segfaults occur.

There is also a comment in the Makefile about having to disable several gcc
optimizations to avoid segfaults.

I did some debugging, and it turns out that the inline cpuid() implementation
can inadvertently clobber registers, causing the cpu_heirarchy_info struct in
'chi' to be destroyed.  Later on, this can lead to segfaults.

I replaced the cpuid() implementation by a more standard one, and that solves
all crashes for me.  I tried compiling with:

* clang 3.4.1 (on stable/10), with default flags
* clang 3.4.1 (on stable/10), with CPUTYPE=core-avx2
* clang 3.4.1 (on stable/10), with CPUTYPE=core-avx2 and -O3
* gcc 4.2.1 (on stable/10), with default flags
* gcc 4.2.1 (on stable/10), with -O3

There was also no more need to use -fno-schedule-insns2 -fno-schedule-insns
-fno-caller-saves for gcc.

In addition, I fixed a number of warnings about printf formats used for time_t,
but that is mostly cosmetic.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list