From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#29040: Emacs 25 hangs on windows arbitrarily during search of a unicode file Date: Thu, 2 Nov 2017 22:03:17 -0700 Organization: UCLA Computer Science Department Message-ID: <8d805311-7837-681b-55c0-32e61c8a3b60@cs.ucla.edu> References: <83wp38r87q.fsf@gnu.org> <136c8415-5027-e149-b8b1-5b08da5815f3@cs.ucla.edu> <83k1z8wgrw.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------3B112DF735F0C4818F4BDA87" X-Trace: blaine.gmane.org 1509685457 1902 195.159.176.226 (3 Nov 2017 05:04:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 3 Nov 2017 05:04:17 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 Cc: rcopley@gmail.com, 29040@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 03 06:04:10 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eAU9I-0008Am-Eo for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Nov 2017 06:04:08 +0100 Original-Received: from localhost ([::1]:34923 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eAU9M-0005dh-HQ for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Nov 2017 01:04:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eAU9G-0005dS-9y for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2017 01:04:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eAU9D-0006T4-2O for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2017 01:04:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39876) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eAU9C-0006SQ-Ub for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2017 01:04:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eAU9C-0008Lv-HJ for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2017 01:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Nov 2017 05:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29040 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 29040-submit@debbugs.gnu.org id=B29040.150968540732064 (code B ref 29040); Fri, 03 Nov 2017 05:04:02 +0000 Original-Received: (at 29040) by debbugs.gnu.org; 3 Nov 2017 05:03:27 +0000 Original-Received: from localhost ([127.0.0.1]:48557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eAU8c-0008L6-UH for submit@debbugs.gnu.org; Fri, 03 Nov 2017 01:03:27 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:40796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eAU8b-0008Kt-8h for 29040@debbugs.gnu.org; Fri, 03 Nov 2017 01:03:26 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 697D51600EA; Thu, 2 Nov 2017 22:03:19 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 1d3KGTJ16-zh; Thu, 2 Nov 2017 22:03:18 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 033A91605ED; Thu, 2 Nov 2017 22:03:18 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id x9lV1XAMbLGT; Thu, 2 Nov 2017 22:03:17 -0700 (PDT) Original-Received: from [192.168.1.9] (unknown [47.154.18.85]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id CE8A81600EA; Thu, 2 Nov 2017 22:03:17 -0700 (PDT) In-Reply-To: <83k1z8wgrw.fsf@gnu.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:139386 Archived-At: This is a multi-part message in MIME format. --------------3B112DF735F0C4818F4BDA87 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Eli Zaretskii wrote: > Thanks, but I think the resulting code is confusing. E.g.: >=20 > static struct thread_state GCALIGNED main_thread; >=20 > This looks like we ask main_thread to be 8-byte aligned, which would > bring back the problems we had before. I attempted to clarify this by installing the first attached patch into t= he=20 emacs-26 branch. This patch adds a comment to the definition of GCALIGNED= . If=20 the name "GCALIGNED" itself is confusing, we can systematically change th= e name=20 to something else. (The name doesn't confuse me, but perhaps I'm too clo= se to=20 the code.) > I don't know anything about that code, and I don't think anyone does. > Who will tell us that the comment is still accurate? Since MSVC is no longer relevant, it doesn't matter whether the comment a= bout=20 MSVC is accurate, and we can remove it. > Anything that is conditioned by _MSC_VER can go. I did that by installing the second attached patch into 'master'. This af= fects=20 only the mainline code; I didn't fiddle with the MS-Windows-only files si= nce I=20 can't easily test them. --------------3B112DF735F0C4818F4BDA87 Content-Type: text/x-patch; name="0001-src-lisp.h-GCALIGNED-Clarify-comment-Bug-29040.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0001-src-lisp.h-GCALIGNED-Clarify-comment-Bug-29040.patch" =46rom a87ce5c4b41ca8146c764b1186a6162c069b1933 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 2 Nov 2017 20:04:25 -0700 Subject: [PATCH] * src/lisp.h (GCALIGNED): Clarify comment (Bug#29040). --- src/lisp.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lisp.h b/src/lisp.h index bf9db59..a71ba22 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -272,8 +272,9 @@ error !; #endif =20 /* Declare an object to have an address that is a multiple of - GCALIGNMENT. alignas is not suitable here, as it fails if the - object's natural alignment exceeds GCALIGNMENT. */ + GCALIGNMENT. This is a no-op if the object's natural alignment is + already a multiple of GCALIGNMENT. alignas is not suitable here, + as it fails if the object's natural alignment exceeds GCALIGNMENT. *= / #ifdef HAVE_STRUCT_ATTRIBUTE_ALIGNED # define GCALIGNED __attribute__ ((aligned (GCALIGNMENT))) #else --=20 2.7.4 --------------3B112DF735F0C4818F4BDA87 Content-Type: text/x-patch; name="0001-Simplify-by-assuming-_MSC_VER.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Simplify-by-assuming-_MSC_VER.patch" =46rom 5b4ff53ab4579532b1b9eba233c135fee274d674 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 2 Nov 2017 21:54:23 -0700 Subject: [PATCH] Simplify by assuming !_MSC_VER. Emacs has not been portable to MSVC for some time (Bug#29040#57). * admin/CPP-DEFINES (_MSC_VER): Remove. * src/lisp.h (ENUM_BF, DEFUN): * src/regex.c (re_char): Simplify by assuming _MSC_VER is not defined. * src/regex.c (const_re_char): Remove. All uses replaced by re_char. --- admin/CPP-DEFINES | 1 - src/lastfile.c | 3 --- src/lisp.h | 16 ++-------------- src/regex.c | 32 +++++++++++++------------------- 4 files changed, 15 insertions(+), 37 deletions(-) diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES index 10b558d..eb3eadf 100644 --- a/admin/CPP-DEFINES +++ b/admin/CPP-DEFINES @@ -19,7 +19,6 @@ __DJGPP_MINOR__ Minor version number of the DJGPP libra= ry; used only in msdos.c DOS_NT Compiling for either the MS-DOS or native MS-Windows port. WINDOWSNT Compiling the native MS-Windows (W32) port. __MINGW32__ Compiling the W32 port with the MinGW or MinGW-w64 ports of = GCC. -_MSC_VER Compiling the W32 port with the Microsoft C compiler. MINGW_W64 Compiling the W32 port with the MinGW-w64 port of GCC. DARWIN_OS Compiling on macOS or pure Darwin (and using s/darwin.h). SOLARIS2 diff --git a/src/lastfile.c b/src/lastfile.c index 2901f14..1302279 100644 --- a/src/lastfile.c +++ b/src/lastfile.c @@ -49,9 +49,6 @@ char my_edata[] =3D "End of Emacs initialized data"; isn't always a separate section in NT executables). */ char my_endbss[1]; =20 -/* The Alpha MSVC linker globally segregates all static and public bss - data, so we must take both into account to determine the true extent - of the bss area used by Emacs. */ static char _my_endbss[1]; char * my_endbss_static =3D _my_endbss; =20 diff --git a/src/lisp.h b/src/lisp.h index a71ba22..1a8c3a0 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -418,9 +418,8 @@ error !; #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 =20 /* Idea stolen from GDB. Pedantic GCC complains about enum bitfields, - MSVC doesn't support them, and xlc and Oracle Studio c99 complain - vociferously about them. */ -#if (defined __STRICT_ANSI__ || defined _MSC_VER || defined __IBMC__ \ + and xlc and Oracle Studio c99 complain vociferously about them. */ +#if (defined __STRICT_ANSI__ || defined __IBMC__ \ || (defined __SUNPRO_C && __STDC__)) #define ENUM_BF(TYPE) unsigned int #else @@ -2935,23 +2934,12 @@ CHECK_NUMBER_CDR (Lisp_Object x) =20 /* This version of DEFUN declares a function prototype with the right arguments, so we can catch errors with maxargs at compile-time. */ -#ifdef _MSC_VER -#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ - Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ - static struct Lisp_Subr GCALIGNED sname =3D \ - { { (PVEC_SUBR << PSEUDOVECTOR_AREA_BITS) \ - | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)) }, \ - { (Lisp_Object (__cdecl *)(void))fnname }, = \ - minargs, maxargs, lname, intspec, 0}; \ - Lisp_Object fnname -#else /* not _MSC_VER */ #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ static struct Lisp_Subr GCALIGNED sname =3D \ { { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \ { .a ## maxargs =3D fnname }, \ minargs, maxargs, lname, intspec, 0}; \ Lisp_Object fnname -#endif =20 /* defsubr (Sname); is how we define the symbol for function `name' at start-up time. */= diff --git a/src/regex.c b/src/regex.c index 330f2f7..d3d910d 100644 --- a/src/regex.c +++ b/src/regex.c @@ -519,13 +519,7 @@ ptrdiff_t emacs_re_safe_alloca =3D MAX_ALLOCA; #endif =20 /* Type of source-pattern and string chars. */ -#ifdef _MSC_VER -typedef unsigned char re_char; -typedef const re_char const_re_char; -#else typedef const unsigned char re_char; -typedef re_char const_re_char; -#endif =20 typedef char boolean; =20 @@ -2403,7 +2397,7 @@ do { \ } while (0) =20 static reg_errcode_t -regex_compile (const_re_char *pattern, size_t size, +regex_compile (re_char *pattern, size_t size, #ifdef emacs # define syntax RE_SYNTAX_EMACS bool posix_backtracking, @@ -3728,7 +3722,7 @@ insert_op2 (re_opcode_t op, unsigned char *loc, int= arg1, int arg2, unsigned cha least one character before the ^. */ =20 static boolean -at_begline_loc_p (const_re_char *pattern, const_re_char *p, reg_syntax_t= syntax) +at_begline_loc_p (re_char *pattern, re_char *p, reg_syntax_t syntax) { re_char *prev =3D p - 2; boolean odd_backslashes; @@ -3769,7 +3763,7 @@ at_begline_loc_p (const_re_char *pattern, const_re_= char *p, reg_syntax_t syntax) at least one character after the $, i.e., `P < PEND'. */ =20 static boolean -at_endline_loc_p (const_re_char *p, const_re_char *pend, reg_syntax_t sy= ntax) +at_endline_loc_p (re_char *p, re_char *pend, reg_syntax_t syntax) { re_char *next =3D p; boolean next_backslash =3D *next =3D=3D '\\'; @@ -3813,7 +3807,7 @@ group_in_compile_stack (compile_stack_type compile_= stack, regnum_t regnum) Return -1 if fastmap was not updated accurately. */ =20 static int -analyze_first (const_re_char *p, const_re_char *pend, char *fastmap, +analyze_first (re_char *p, re_char *pend, char *fastmap, const int multibyte) { int j, k; @@ -4555,7 +4549,7 @@ static int bcmp_translate (re_char *s1, re_char *s2= , /* If the operation is a match against one or more chars, return a pointer to the next operation, else return NULL. */ static re_char * -skip_one_char (const_re_char *p) +skip_one_char (re_char *p) { switch (*p++) { @@ -4597,7 +4591,7 @@ skip_one_char (const_re_char *p) =20 /* Jump over non-matching operations. */ static re_char * -skip_noops (const_re_char *p, const_re_char *pend) +skip_noops (re_char *p, re_char *pend) { int mcnt; while (p < pend) @@ -4628,7 +4622,7 @@ skip_noops (const_re_char *p, const_re_char *pend) character (i.e. without any translations). UNIBYTE denotes whether c= is unibyte or multibyte character. */ static bool -execute_charset (const_re_char **pp, unsigned c, unsigned corig, bool un= ibyte) +execute_charset (re_char **pp, unsigned c, unsigned corig, bool unibyte)= { re_char *p =3D *pp, *rtp =3D NULL; bool not =3D (re_opcode_t) *p =3D=3D charset_not; @@ -4692,8 +4686,8 @@ execute_charset (const_re_char **pp, unsigned c, un= signed corig, bool unibyte) =20 /* Non-zero if "p1 matches something" implies "p2 fails". */ static int -mutually_exclusive_p (struct re_pattern_buffer *bufp, const_re_char *p1,= - const_re_char *p2) +mutually_exclusive_p (struct re_pattern_buffer *bufp, re_char *p1, + re_char *p2) { re_opcode_t op2; const boolean multibyte =3D RE_MULTIBYTE_P (bufp); @@ -4931,8 +4925,8 @@ WEAK_ALIAS (__re_match_2, re_match_2) /* This is a separate function so that we can force an alloca cleanup afterwards. */ static regoff_t -re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *stri= ng1, - size_t size1, const_re_char *string2, size_t size2, +re_match_2_internal (struct re_pattern_buffer *bufp, re_char *string1, + size_t size1, re_char *string2, size_t size2, ssize_t pos, struct re_registers *regs, ssize_t stop) { /* General temporaries. */ @@ -6222,10 +6216,10 @@ re_match_2_internal (struct re_pattern_buffer *bu= fp, const_re_char *string1, bytes; nonzero otherwise. */ =20 static int -bcmp_translate (const_re_char *s1, const_re_char *s2, register ssize_t l= en, +bcmp_translate (re_char *s1, re_char *s2, ssize_t len, RE_TRANSLATE_TYPE translate, const int target_multibyte) { - register re_char *p1 =3D s1, *p2 =3D s2; + re_char *p1 =3D s1, *p2 =3D s2; re_char *p1_end =3D s1 + len; re_char *p2_end =3D s2 + len; =20 --=20 2.7.4 --------------3B112DF735F0C4818F4BDA87--