Summary: | media-gfx/fontforge encoding.c:(.text+0x6c3d): undefined reference to `__warn_memset_zero_len' | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | cristiano04 |
Component: | Current packages | Assignee: | Gentoo Fonts Team <fonts> |
Status: | RESOLVED OBSOLETE | ||
Severity: | normal | CC: | floppym, fonts, jer |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | https://github.com/fontforge/fontforge/issues/3008 | ||
See Also: |
https://bugs.gentoo.org/show_bug.cgi?id=606740 https://github.com/fontforge/fontforge/issues/3008 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | build.log |
Description
cristiano04
2015-10-01 01:08:15 UTC
The snippet is inconclusive - attach the whole log. (In reply to Rafał Mużyło from comment #1) > The snippet is inconclusive - attach the whole log. As you wish. ... for some reason the 'add an attachment' option isn't working so: http://s000.tinyupload.com/download.php?file_id=03073235506804015775&t=0307323550680401577560547 Created attachment 414170 [details]
build.log
toolchain: Any idea what is happening here? this is WAI. fontforge has bad code and thus glibc forces it to fail. the log: In file included from /usr/include/string.h:635:0, from ../lib/string.h:41, from fontforge.h:35, from fontforgevw.h:30, from encoding.c:28: In function ‘memset’, inlined from ‘EncMapFromEncoding’ at encoding.c:1868:11: /usr/include/bits/string3.h:86:30: warning: call to ‘__warn_memset_zero_len’ declared with attribute warning: memset used with constant zero length parameter; this could be due to transposed parameters [enabled by default] __warn_memset_zero_len (); ^ the solution: don't call memset with len=0. it's pointless and most likely a bug in the code. Line 1868 of fontforge/encoding.c is this: memset(encoded,-1,base*sizeof(int32)); The warning states it is being called with a constant zero parameter -- which clearly is not true. The 'base' parameter may be zero, but it is not always and the code seems correct to me. Also, I am unable to reproduce this failure with glibc-2.21 and gcc-4.8.5 or gcc-5.2.0. Can you take a closer look? This seems like something weird, possibly relayed to glibc-2.22. (In reply to Mike Gilbert from comment #6) the code is being called with a constant param. look up a few lines to see where base is set to constants. the first if statement: if ( enc->is_original ) base = 0; it doesn't fail with gcc-5+ because glibc includes this fortification checking only for <=gcc-4.9. it doesn't need it with gcc-5+ because the compiler itself will take care of warning for you. the code looks suspicious to me in general because it does: base = 0; encoded = malloc(base*sizeof(int32)); <-- this may return NULL memset(encoded,-1,base*sizeof(int32)); then based on other parameters, it'll write to the encoded pointer later on. i'm not familiar with the codebase though to say whether it's possible to pass in arguments such that you'll deref the NULL pointer. at any rate, you can workaround it by adding a sanity check like: if (base) memset(encoded,-1,base*sizeof(int32)); i can't see glibc or gcc changing here. I guess I'm still a bit mystified as to why I a unable to reproduce the warning with either gcc 4.8.5 or 5.2.0. I have -Wall in CFLAGS but I still don't see it. (In reply to Mike Gilbert from comment #8) reproduced fine for me w/gcc-4.8 and gcc-4.9. it makes sense that you won't hit it with gcc-5+ because glibc specifically disables the code for those versions. Are you on glibc 2.22? I'm still using 2.21. Also, if gcc5 has the warning built in, I should be seeing that, no? (In reply to Mike Gilbert from comment #10) yes, i'm using glibc-2.22 gcc-5 not warning is most likely due to different heuristics in use by gcc. i would have to read its source to figure out in what scenarios exactly it would issue the warning. but does that really matter here ? I reported the issue upstream. If someone wants to submit a patch, please do. Not really a toolchain problem, also noone has filed duplicates... -> ? |