bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Use opaque struct rather than char * in regex.h


From: Jim Meyering
Subject: Re: [PATCH] Use opaque struct rather than char * in regex.h
Date: Wed, 04 Apr 2012 06:34:47 +0200

Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> Hello, all. It's a common problem when program attempts to access
> unaligned pointer. On x86 this usually goes unnoticed but on other CPUs
> it results in segmentation fault. -Wcast-align is a good way to check
> that no such problem occurs. Unfortunately regex module breaks the
> invariants by casting char * to a re_dfa_t *. Attached patch fixes it

Hi Vlad,

How about just adding a #pragma to disable that warning, instead,
assuming it was just in regcomp.c?

The alternative (your patch or similar) would move the definition
of re_dfa_t from its private header to a public one.  If, say, the
glibc folks prefer your patch, you'll want to adjust this comment
to match the new code:

   /* Space that holds the compiled pattern.  It is declared as
      'unsigned char *' because its elements are sometimes used as
      array indexes.  */
-  unsigned char *__REPB_PREFIX(buffer);
+  re_dfa_t *__REPB_PREFIX(buffer);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]