From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 20 04:52:45 2013 Received: (at submit) by debbugs.gnu.org; 20 Mar 2013 08:52:45 +0000 Received: from localhost ([127.0.0.1]:36735 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UIElI-0001qx-L0 for submit@debbugs.gnu.org; Wed, 20 Mar 2013 04:52:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40237) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UIElF-0001qn-Oo for submit@debbugs.gnu.org; Wed, 20 Mar 2013 04:52:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIEjU-0003FC-B9 for submit@debbugs.gnu.org; Wed, 20 Mar 2013 04:50:57 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:37096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIEhI-0001ZS-AQ for submit@debbugs.gnu.org; Wed, 20 Mar 2013 04:48:36 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIEhB-0002zX-Ug for bug-gnu-emacs@gnu.org; Wed, 20 Mar 2013 04:48:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIEh1-0001SX-SK for bug-gnu-emacs@gnu.org; Wed, 20 Mar 2013 04:48:29 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:45870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIEh1-0001Rc-GS for bug-gnu-emacs@gnu.org; Wed, 20 Mar 2013 04:48:19 -0400 Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id AA6E7207B0 for ; Wed, 20 Mar 2013 04:48:17 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute6.internal (MEProxy); Wed, 20 Mar 2013 04:48:17 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=from:to:subject:date:message-id:mime-version:content-type; s= mesmtp; bh=R4qXpqaGNC7RQ6m3XwbLpFM8Adc=; b=fXttl9Ek6aZ6Xba4qrx/5 32DEG4MRaRG59kyoCC64JVd+E+f8ZdOmVVF9fXa1+t6UQsc45eWtgylT8bpAAzBh 58Nxn+Il42IavHmK6D5z214wuJGD1a0UlT/wpeym/RrkoMTavFzD2ALoA85f0C0D LgMWevtP98w4Hy3+pJXDgM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:subject:date:message-id :mime-version:content-type; s=smtpout; bh=R4qXpqaGNC7RQ6m3XwbLpF M8Adc=; b=d2Qu0QlrZWe7lw12+EfXwLyE7Ez3sNldKnz7lsz+IRDyi+2qOb6iuQ Dr3lbZlTUawXbfUNW0qdr0lwagkMrGVugwNDxhmVVcHXTMXkhZVK6CQyDZdxSv8p mUImcoWYcjUyDLLINHc9eiedL0tZJkgAP+wWO6PddQFLvvyAi2LMA= X-Sasl-enc: czgpNG8SbRA6bXpdPsaiOzmDxTzT0xh13HRcrPNeehTZ 1363769297 Received: from shorty.local (unknown [66.8.228.24]) by mail.messagingengine.com (Postfix) with ESMTPA id 38A9820007B for ; Wed, 20 Mar 2013 04:48:17 -0400 (EDT) Received: from dima by shorty.local with local (Exim 4.80) (envelope-from ) id 1UIEgx-00048J-6b for bug-gnu-emacs@gnu.org; Tue, 19 Mar 2013 22:48:15 -1000 From: Dima Kogan To: bug-gnu-emacs@gnu.org Subject: 24.3.50; cc-mode: Incorrectly-indented C code (wrong syntax). Test case and bisection. Date: Tue, 19 Mar 2013 22:48:14 -1000 Message-ID: <87y5di78z5.fsf@secretsauce.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) --=-=-= Content-Type: text/plain I'm observing very uninteresting-looking C code get incorrectly-indented. The sample source file (attached) ends with the following function: static Matrix *NonMaximalSuppression(Matrix *strength, Matrix *orientation) { int x, y, i, rows = strength->rows, cols = strength->cols; int pixels = strength->rows * strength->cols, maximum; double str1, str2; /* interpolated edge strength */ double a1, a2, b1, b2, c1, c2; /* nearest pixels' edge strength */ float ux, uy; /* weights of a, b, c, and str */ double ori, str; /* strength and orientation at center */ Matrix *newstrength; /* Newstrength holds the NMS'ed strength values */ newstrength = (Matrix *)malloc(sizeof(Matrix)); newstrength->rows = strength->rows; newstrength->sheets = 1; newstrength->cols = strength->cols; newstrength->ptr = (double *)calloc(pixels, sizeof(double)); return(newstrength); } I'm observing that everything after the /* Newstrength .... */ comment gets "string" syntax, which is incorrect. This can be seen with (c-guess-basic-syntax). This also causes incorrect indentation of the empty line before the return statement (TAB there should move to column 2, but it stays at 0). The full test source file is attached (called "tst.c"). This is a slight modification of the source from http://ai.stanford.edu/~ruzon/compass/. This test case is much longer than I'd like, but the bug appears to be very sensitive to preceding code, so I'm leaving it alone. To observe the issue, you can run $ emacs -Q --batch --eval '(progn (find-file "/tmp/tst.c") (goto-char 6072) (message "%s" (c-guess-basic-syntax))) The right answer is "statement", but the current version of emacs says "string". I did a bisection. This problem was introduced in early 2012 with this commit: http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b0b68fedb6a6fe7bc55c1fe4f256bda9a93134b5 This means that all releases of emacs 24 are affected. Thanks. --=-=-= Content-Type: text/x-csrc Content-Disposition: attachment; filename=tst.c Content-Description: test case /*************************************************************************** * The Greyscale Compass Operator -- an algorithm to find edges in * * greyscale images by representing regions with distributions * * * * Mark A. Ruzon * * Stanford Vision Laboratory * * October, 1997 * * Copyright 1997-1999. All rights reserved. * * * * Details -- The compass operator uses a circular window centered at a * * junction where 4 pixel squares meet. The needle is a diameter at a * * given orientation. The intensity distributions of the two * * semicircles are computed, and the distance between them is measured * * using the Earth Mover's Distance (EMD). The maximum EMD over all * * orientations gives the edge strength and orientation at that point. * * Uncertainty and abnormality are also measured. * * * * This file contains the Unix wrapper for the compass operator. * * * * 2 August 1999 -- extended for use with greyscale images * * * * 7 October 1999 -- creation of the Unix wrapper. Most of the * * functionality of the MATLAB version (e.g. subimages, spacing, plot, * * maxclusters, multiple sigmas, abnormality, uncertainty, etc.) * * is being removed. * * * * 21 October 1999 -- allowed only compass operator and NMS routine, or * * only thresholding, or both to be computed. * ***************************************************************************/ #include #include #include #include #include "greycompass.h" #define MAXVAL 255 #define MAXLINE 2000 #define PI 3.14159265358979323846 #define MODEC 0x2 #define MODET 0x1 #warning this should generate an error since it should be exported static void Error(char *text) { fprintf(stderr,text); exit(1); } static void PrintHelp(char *programname) { fprintf(stderr,"Function: %s [options]\n", programname); fprintf(stderr," / are input/output images\n"); fprintf(stderr," options include:\n"); fprintf(stderr," -s , the standard deviation of the Gaussian (default 1.0)\n"); fprintf(stderr," -m C|T, the mode, compass operator or thresholding (default: both)\n"); fprintf(stderr," -l , the low threshold for edge detection (default 0.5)\n"); fprintf(stderr," -h , the high threshold for edge detection (default 0.7)\n"); exit(1); } static CvMat* readIntoMat( const char* filename, int type ) { CvMat* img = cvLoadImageM( filename, CV_LOAD_IMAGE_GRAYSCALE ); if( !img ) return NULL; if( type == img->type ) return img; CvMat* img_wantedtype = cvCreateMat( img->rows, img->cols, type ); if( !img_wantedtype ) return NULL; cvConvert( img, img_wantedtype ); cvRelease( &img ); return img_wantedtype; } static void ParseArguments(int argc, char *argv[], CvMat** input, double sigma[], double *low, double *high, int *mode) { int curarg = 3; char modechar; if (argc < 3) PrintHelp(argv[0]); while (curarg < argc) { if (argv[curarg][0] == '-') { /* New argument has appeared */ switch(argv[curarg][1]) { case 's': /* Sigma */ if (curarg < argc) { sigma[0] = strtod(argv[curarg+1],NULL); if (sigma[0] <= 0.0) Error("Sigma must be positive\n"); } else Error("No sigma value specified\n"); break; case 'l': /* Low */ if (curarg < argc) { *low = strtod(argv[curarg+1],NULL); if (*low < 0.0 || *low > 1.0) Error("Low threshold must lie in [0,1]\n"); } else Error("No low threshold specified\n"); break; case 'h': /* High */ if (curarg < argc) { *high = strtod(argv[curarg+1],NULL); if (*high < 0.0 || *high > 1.0) Error("High threshold must lie in [0,1]\n"); } else Error("No high threshold specified\n"); break; case 'm': /* Mode */ if (curarg < argc) { modechar = argv[curarg+1][0]; if (modechar == 'C' || modechar == 'c') *mode = MODEC; else if (modechar == 'T' || modechar == 't') *mode = MODET; else Error("Mode must be 'C' or 'T'\n"); } else Error("No mode specified\n"); break; default: /* Help */ fprintf(stderr,"Unrecognized command option\n"); PrintHelp(argv[0]); break; } curarg += 2; } } if (*high < *low) Error("High threshold cannot be below low threshold\n"); *input = readIntoMat( argv[1], (*mode & MODEC) ? CV_8UC1 : CV_64FC1 ); if( ! *input ) Error("Error reading input\n"); } /* NonMaximalSuppression * * The standard Canny non-maximal suppression algorithm; looks in a 3x3 * neighborhood to determine if the pixel is a maximum in the direction * perpendicular to that of the edge orientation. */ static Matrix *NonMaximalSuppression(Matrix *strength, Matrix *orientation) { int x, y, i, rows = strength->rows, cols = strength->cols; int pixels = strength->rows * strength->cols, maximum; double str1, str2; /* interpolated edge strength */ double a1, a2, b1, b2, c1, c2; /* nearest pixels' edge strength */ float ux, uy; /* weights of a, b, c, and str */ double ori, str; /* strength and orientation at center */ Matrix *newstrength; /* Newstrength holds the NMS'ed strength values */ newstrength = (Matrix *)malloc(sizeof(Matrix)); newstrength->rows = strength->rows; newstrength->sheets = 1; newstrength->cols = strength->cols; newstrength->ptr = (double *)calloc(pixels, sizeof(double)); return(newstrength); } --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 22 04:24:39 2013 Received: (at control) by debbugs.gnu.org; 22 Mar 2013 08:24:39 +0000 Received: from localhost ([127.0.0.1]:40027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UIxHC-0007pX-Rr for submit@debbugs.gnu.org; Fri, 22 Mar 2013 04:24:39 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:42440) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UIxHA-0007pQ-WB for control@debbugs.gnu.org; Fri, 22 Mar 2013 04:24:37 -0400 Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 53FFD20FA2 for ; Fri, 22 Mar 2013 04:22:41 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute6.internal (MEProxy); Fri, 22 Mar 2013 04:22:41 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=from:to:subject:date:message-id:mime-version:content-type; s= mesmtp; bh=bqyR77ZdAD7PvGVO9ddUSpA6jYc=; b=vrUW4ZVMlQetw3QU0w2Dy lbOOWDPY+8J7K8IRzICQPspH5ZaO11R2XFWEinksZi8eq2BnlUEU9giWWjvGw6ti 5tJEA0RzGAWjFz8njc7Q0RUoFV02HRjHlo6cOelCPH5KhS7U5BBoR47tk/euPWIp MST1ZxtRlZ06BRKe0Menlw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:subject:date:message-id :mime-version:content-type; s=smtpout; bh=bqyR77ZdAD7PvGVO9ddUSp A6jYc=; b=AYajDK37enTaLietl1ydDuPbCRP7q8404cvrTkIldVLdPFBCTxI3zD RQwYsVHB2O1xGQQMUJMjaPLErZgT7fOt4CaGdHvdXfQI2dkV2hirtApTPQJ4FmfR LHurBuFDYhwG4zIRj94E9BQ0wBt07uBdM/JUiDC7hYtOh7hpvyZ4E= X-Sasl-enc: A/l0Q7GqEY17C47TVGxCz66xRlwumW7ddXT9Ysi4tftJ 1363940561 Received: from shorty.local (unknown [66.8.228.24]) by mail.messagingengine.com (Postfix) with ESMTPA id 006582000BF for ; Fri, 22 Mar 2013 04:22:40 -0400 (EDT) Received: from dima by shorty.local with local (Exim 4.80) (envelope-from ) id 1UIxFH-0005Qr-7L for control@debbugs.gnu.org; Thu, 21 Mar 2013 22:22:39 -1000 From: Dima Kogan To: control@debbugs.gnu.org Subject: User-agent: mu4e 0.9.9; emacs 24.3.50.1 Date: Thu, 21 Mar 2013 22:22:31 -1000 Message-ID: <87fvzn6dyw.fsf@secretsauce.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 2.1 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: reassign 14005 emacs,cc-mode [...] Content analysis details: (2.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [66.111.4.25 listed in list.dnswl.org] 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.4995] 2.0 BLANK_SUBJECT Subject is present but empty 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: reassign 14005 emacs,cc-mode [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [66.111.4.25 listed in list.dnswl.org] -0.0 BAYES_40 BODY: Bayes spam probability is 20 to 40% [score: 0.2886] 2.0 BLANK_SUBJECT Subject is present but empty 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid 0.0 TVD_SPACE_RATIO TVD_SPACE_RATIO reassign 14005 emacs,cc-mode From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 24 16:45:19 2015 Received: (at 14005-done) by debbugs.gnu.org; 24 Dec 2015 21:45:19 +0000 Received: from localhost ([127.0.0.1]:33892 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aCDhH-0007HG-I3 for submit@debbugs.gnu.org; Thu, 24 Dec 2015 16:45:19 -0500 Received: from mail.muc.de ([193.149.48.3]:39473) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aCDhF-0007H6-NQ for 14005-done@debbugs.gnu.org; Thu, 24 Dec 2015 16:45:18 -0500 Received: (qmail 74611 invoked by uid 3782); 24 Dec 2015 21:45:16 -0000 Received: from acm.muc.de (p548A5291.dip0.t-ipconnect.de [84.138.82.145]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 24 Dec 2015 22:45:15 +0100 Received: (qmail 6391 invoked by uid 1000); 24 Dec 2015 21:47:34 -0000 Date: Thu, 24 Dec 2015 21:47:34 +0000 To: Dima Kogan Subject: Re: bug#14005: 24.3.50; cc-mode: Incorrectly-indented C code (wrong syntax). Test case and bisection. Message-ID: <20151224214734.GB5714@acm.fritz.box> References: <87y5di78z5.fsf@secretsauce.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87y5di78z5.fsf@secretsauce.net> User-Agent: Mutt/1.5.23 (2014-03-12) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 14005-done Cc: 14005-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Hello, Dima. The problem is no longer apparent in the current emacs-25 branch at savannah, so I'm closing this bug as fixed. On Tue, Mar 19, 2013 at 10:48:14PM -1000, Dima Kogan wrote: > I'm observing very uninteresting-looking C code get > incorrectly-indented. The sample source file (attached) ends with the > following function: > static Matrix *NonMaximalSuppression(Matrix *strength, Matrix *orientation) > { > int x, y, i, rows = strength->rows, cols = strength->cols; > int pixels = strength->rows * strength->cols, maximum; > double str1, str2; /* interpolated edge strength */ > double a1, a2, b1, b2, c1, c2; /* nearest pixels' edge strength */ > float ux, uy; /* weights of a, b, c, and str */ > double ori, str; /* strength and orientation at center */ > Matrix *newstrength; > /* Newstrength holds the NMS'ed strength values */ > newstrength = (Matrix *)malloc(sizeof(Matrix)); > newstrength->rows = strength->rows; > newstrength->sheets = 1; > newstrength->cols = strength->cols; > newstrength->ptr = (double *)calloc(pixels, sizeof(double)); > return(newstrength); > } > I'm observing that everything after the /* Newstrength .... */ comment > gets "string" syntax, which is incorrect. This can be seen with > (c-guess-basic-syntax). This also causes incorrect indentation of the > empty line before the return statement (TAB there should move to column > 2, but it stays at 0). > The full test source file is attached (called "tst.c"). This is a slight > modification of the source from http://ai.stanford.edu/~ruzon/compass/. > This test case is much longer than I'd like, but the bug appears to be > very sensitive to preceding code, so I'm leaving it alone. > To observe the issue, you can run > $ emacs -Q --batch --eval '(progn (find-file "/tmp/tst.c") (goto-char > 6072) (message "%s" (c-guess-basic-syntax))) > The right answer is "statement", but the current version of emacs says > "string". I did a bisection. This problem was introduced in early 2012 > with this commit: > http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b0b68fedb6a6fe7bc55c1fe4f256bda9a93134b5 > This means that all releases of emacs 24 are affected. > Thanks. -- Alan Mackenzie (Nuremberg, Germany). From unknown Sun Jun 22 22:41:51 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 22 Jan 2016 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator