From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8357 invoked by alias); 21 Feb 2005 22:15:32 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 8266 invoked by uid 48); 21 Feb 2005 22:15:28 -0000 Date: Tue, 22 Feb 2005 02:22:00 -0000 Message-ID: <20050221221528.8265.qmail@sourceware.org> From: "pinskia at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050221214433.20126.jkohen@users.sourceforge.net> References: <20050221214433.20126.jkohen@users.sourceforge.net> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug target/20126] [3.3/3.4/4.0 Regression] Inlined memcmp makes one argument null on entry X-Bugzilla-Reason: CC X-SW-Source: 2005-02/txt/msg02541.txt.bz2 List-Id: ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-21 22:15 ------- Reduced testcase (and shows that this is also a 3.3/3.4/4.0 Regression too): #include #include #include typedef struct { struct _object *_ob_next; struct _object *_ob_prev; int ob_refcnt; struct _typeobject *ob_type; int ob_size; long ob_shash; int ob_sstate; char ob_sval[1]; } strobject; static int string_contains(strobject *a, strobject *el) { const char *lhs, *rhs, *end; int size; size = (((el))->ob_size); rhs = (((el))->ob_sval); lhs = (((a))->ob_sval); if (size == 1) return memchr(lhs, *rhs, (((a))->ob_size)) != ((void *)0); end = lhs + ((((a))->ob_size) - size); while (lhs <= end) { const char *t = lhs+1; if (memcmp(lhs, rhs, size) == 0) return 1; lhs = t; } return 0; } int main(void) { char* s1 = "aa"; char* s2 = "aa"; strobject *obj1; strobject *obj2; obj1 = calloc(1, sizeof (*obj1) + 64); obj2 = calloc(1, sizeof (*obj2) + 64); obj1->ob_size = strlen(s1); obj2->ob_size = strlen(s2); memcpy(&obj1->ob_sval[0], s1, obj1->ob_size); memcpy(&obj2->ob_sval[0], s2, obj2->ob_size); printf("'%*s' in '%*s' = %d\n", obj2->ob_size, obj2->ob_sval, obj1->ob_size, obj1->ob_sval, string_contains(obj1, obj2)); return 0; } -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed| |1 Known to fail| |3.3.3 3.4.0 4.0.0 Known to work| |3.2.3 Last reconfirmed|0000-00-00 00:00:00 |2005-02-21 22:15:27 date| | Summary|Inlined memcmp makes one |[3.3/3.4/4.0 Regression] |argument null on entry |Inlined memcmp makes one | |argument null on entry Target Milestone|--- |3.4.4 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20126