Bug #3776
opengcc can cause segfaults on ctfmerge
0%
Description
The issue was found initially in NetBSD:
https://github.com/jsonn/src/commit/924b243eee68869ee5ed48f2b2fab9815c4f4e82
GCC happens to use invalid ((unsigned)-1) value for DW_AT_byte_size to denote a variable size in an object.
I readapted the NetBSD patch for use in FreeBSD and in the process also unsigned some variables to clear some signed/unsigned comparison issues.
Files
Updated by Andrew Stormont almost 10 years ago
The change to intr_nbits is causing a build failure on my environment. Changing it back to 'int' allows things to build.
Updated by Pedro Giffuni almost 10 years ago
Andrew Stormont wrote:
The change to intr_nbits is causing a build failure on my environment. Changing it back to 'int' allows things to build.
Hi Andrew;
It would be interesting to know the exact failure ;).
Perhaps changing it to "unsigned int" works?
Updated by Pedro Giffuni almost 10 years ago
- File patch-gcc-cvt.diff patch-gcc-cvt.diff added
The problem is that in my environment (gcc/clang) complains about comparing signed with unsigned values and, at least in principle, sizes should be unsigned, which is what is causing this patch.
I left intr_nbits signed but I made ml_size unsigned (uint64_t as in Illumos according to opengrok). In order to avoid the warnings I used casts. It is somewhat ugly but it just works.
Updated by Pedro Giffuni almost 10 years ago
- File patch-gcc-fix.diff patch-gcc-fix.diff added
Pedro Giffuni wrote:
I left intr_nbits signed but I made ml_size unsigned (uint64_t as in Illumos according to opengrok). In order to avoid the warnings I used casts. It is somewhat ugly but it just works.
On second thoughts, ml_size as a simple uint_t should be enough: the uint64_t ml_size that opengrok found is likely unrelated.
Updated by Pedro Giffuni almost 10 years ago
The patch has been committed with minor changes in FreeBSD: