Bug 60388
| Summary: | strlen() builtin bug | ||
|---|---|---|---|
| Product: | [Retired] Red Hat Raw Hide | Reporter: | Need Real Name <ilatypov> |
| Component: | gcc3 | Assignee: | Jakub Jelinek <jakub> |
| Status: | CLOSED RAWHIDE | QA Contact: | |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 1.0 | ||
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | i386 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2002-02-27 06:46:54 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
This was fixed by http://gcc.gnu.org/ml/gcc-patches/2002-01/msg00436.html |
From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8+) Gecko/20020212 Description of problem: The builtin strlen() produced a wrong value in the short test program I included below. Certain conditions had to be met to reproduce the bug: * the char pointer variable had to be of global scope * the variable had to be referred to before incrementing Upgrading Rawhide gcc RPMs from 3.1-0.11 to 3.1-0.21 has fixed the bug. However, I could not find a bug report on strlen() builtin in GNATS or RedHat Bugzilla. ============================================================== #include <string.h> #include <stdio.h> // Compile this with Rawhide RPMs pertaining to gcc-3.1-0.11: // gcc -O2 -o strlen strlen.c char *start; // Must be of global scope to trigger the bug int main() { char *s = "test"; start = s; // Must refer to "start" before incrementing to trigger the bug: printf("s \"%s\", len %d\n", s, start - s); start += strlen(s); printf("s \"%s\", len %d\n", s, start - s); return 0; } ============================================================== Version-Release number of selected component (if applicable): gcc-3.1-0.11 et al. How reproducible: Always Steps to Reproduce: $ gcc -O2 -o strlen strlen.c $ ./strlen Actual Results: s "test", len 0 s "test", len 5 Expected Results: s "test", len 0 s "test", len 4 Additional info: I submitted a similar report to GCC GNATS bug tracking system today.