https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78117
Bug ID: 78117 Summary: gcc on tilegx builds faulty strstr() function (from glibc) Product: gcc Version: 6.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: hgb at ifi dot uio.no Target Milestone: --- Created attachment 39893 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39893&action=edit Output of gcc -V for the relevant cross-compilers We have a target running on Tilera's tilegx processor (now Mellanox), where we've been using gcc-4.8.2 with a patchset (rather large patchset) from Tilera. This combination works fine with any version of glibc I've tested. I'm trying to upgrade to gcc-6.2, this time with no patches from Tilera. For the most part, it works fine, but glibc's strstr function (written for tilegx) does not work. The problem is that it will not find entries in the last part (final 8 bytes or so, depending on alignment) of the haystack string. >From my debugging so far, it seems to me that a part of the code (which is close to assembly to begin with) is simply optimized out. I have pulled the relevant parts of strstr() (mainly the STRSTR2() function) out of glibc and reproduced it with a more-or-less minimal example.