bug-indent
[Top][All Lists]
Advanced

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

Re: Segfault on Comment Line


From: Neil Tiffin
Subject: Re: Segfault on Comment Line
Date: Thu, 21 May 2009 07:47:30 -0500

Ok, a couple of things.

1. Depending on when you checked the source file you may have used the wrong version. After submitting the bug report, I updated the source file from r65 to r99. The original problem version is now here:

        
http://code.google.com/p/rpostgresql/source/browse/trunk/RPostgreSQL/src/RS-PostgreSQL.c?r=65

        svn export -r 65 
http://rpostgresql.googlecode.com/svn/trunk/RPostgreSQL/src/RS-PostgreSQL.c

2. I fixed the problem by running the source through astyle (http://sourceforge.net/projects/astyle ) using the command "astyle --brackets=attach --verbose RS- PostgreSQL.c" then through indent. After being processed by astyle indent did not give any error. You can diff the two files to see the changes.

3. Yes the line "completed = -1;" is ambiguous in the source. Either astyle or indent changed it. The compiler never complained. I am in the process of verifying the correct operation with unit tests.

4. I just verified again that checking out the code via the above svn command still has the same SEGFAULT problem. It may be a line ending problem since svn changes depending on the operating system being used. If you want I can send the exact file as it exists on my system.

5. The warnings at line 139 appear to be where a single line "if" statement is broken into two lines. There are no comments in the vicinity of line 139.

6. running indent with no options on the original problem file seems to work fine. Only reporting the following warnings. indent: RS-PostgreSQL.c:597: Warning:old style assignment ambiguity in "=-". Assuming "= -"

indent: RS-PostgreSQL.c:1118: Warning:old style assignment ambiguity in "=-". Assuming "= -"

7. I verified the problem exists with both GNU indent 2.2.9 and GNU indent 2.2.10.

Neil

On May 21, 2009, at 3:51 AM, indent wrote:

I cannot reproduce the problem with indent 2.2.10 using x64 Suse.

Here is my terminal output:

*> indent --verbose -br -i4 -nut --line-length120
--comment-line-length120 --leave-preprocessor-space -npcs RS- PostgreSQL.c*
option: br
option: i
option: nut
option: l
option: lc
option: lps
option: npcs
There were 1301 non-blank output lines and 274 comments
(Lines with comments)/(Lines with code):  0.248
*> indent --version*
GNU indent 2.2.10

I suggest you look in the input source file UP TO line 139 where you
first get a warning - probably a missing comment close. The warning
about line 597 does not appear, but I do see the following line at L621:

               completed = -1;

What does your compiler say about the input file?

David

Neil Tiffin wrote:
indent 2.2.9 and 2.2.10 are both segfaulting on a comment line and in
the same place.

Below is part of both the resultant file and the source file.  The
full source file is at

   
http://code.google.com/p/rpostgresql/source/browse/trunk/RPostgreSQL/src/RS-PostgreSQL.c


When run under debug the following backtrace is produced

MBP:src nt$ gdb --args /Users/nt/Downloads/indent-2.2.10/src/indent
--verbose -br -i4 -nut --line-length120 --comment-line-length120
--leave-preprocessor-space -npcs RS-PostgreSQL.c
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40
UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-apple-darwin"...Reading symbols for
shared libraries .... done

(gdb) r
Starting program: /Users/neiltiffin/Downloads/indent-2.2.10/src/ indent
--verbose -br -i4 -nut --line-length120 --comment-line-length120
--leave-preprocessor-space -npcs RS-PostgreSQL.c
Reading symbols for shared libraries +++. done
option: br
option: i
option: nut
option: l
option: lc
option: lps
option: npcs
indent: RS-PostgreSQL.c:139: Warning:Line broken 2
indent: RS-PostgreSQL.c:140: Warning:Line broken 2
indent: RS-PostgreSQL.c:141: Warning:Line broken 2
indent: RS-PostgreSQL.c:142: Warning:Line broken 2
indent: RS-PostgreSQL.c:143: Warning:Line broken 2
indent: RS-PostgreSQL.c:144: Warning:Line broken 2
indent: RS-PostgreSQL.c:145: Warning:Line broken 2
indent: RS-PostgreSQL.c:184: Warning:Line broken 2
indent: RS-PostgreSQL.c:185: Warning:Line broken 2
indent: RS-PostgreSQL.c:186: Warning:Line broken 2
indent: RS-PostgreSQL.c:187: Warning:Line broken 2
indent: RS-PostgreSQL.c:188: Warning:Line broken 2
indent: RS-PostgreSQL.c:189: Warning:Line broken 2
indent: RS-PostgreSQL.c:190: Warning:Line broken 2
indent: RS-PostgreSQL.c:360: Warning:Line broken 2
indent: RS-PostgreSQL.c:432: Warning:Line broken 2
indent: RS-PostgreSQL.c:438: Warning:Line broken 2
indent: RS-PostgreSQL.c:597: Warning:old style assignment ambiguity in
"=-".  Assuming "= -"

indent: RS-PostgreSQL.c:618: Warning:Line broken 2
indent: RS-PostgreSQL.c:620: Warning:Line broken 2
indent: RS-PostgreSQL.c:639: Warning:Line broken 2
indent: RS-PostgreSQL.c:674: Warning:Line broken 2

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0002d000
current_column () at code_io.c:204
204            switch (*p)
(gdb) bt
#0  current_column () at code_io.c:204
#1  0x00008158 in print_comment (paren_targ=0x15014,
pbreak_line=0xbffff09c "") at comments.c:273
#2  0x000064a6 in indent (this_file=<value temporarily unavailable,
due to optimizations>) at indent.c:2908
#3  0x00006eab in main (argc=10, argv=0xbffff1bc) at indent.c:3242
(gdb)

I suspect something in the source is causing this.  How do I
troubleshoot to find out? The particular source line looks benign.  I
have checked for goofy characters in the source and there are none.

Neil

the result file ends here.
==============================================================
#define BEGIN_GROUP     4       /* just read in 1'st row for a
different group */
#define END_GROUP       8       /* just read the last row of the
current group */
#define NEW_RECORD     16       /* unin


the partial source file is
==============================================================
s_object    *expand_list(s_object *old, Sint new_len);
void         add_group(s_object *group_names, s_object *data,
                    Stype *fld_Sclass, Sint group,
                Sint ngroup, Sint i);
unsigned int check_groupEvents(s_object *data, Stype fld_Sclass[],
                         Sint row, Sint col);

/* The following are the masks for the events/states we recognize as we
* bring rows from the result set/cursor
*/
#define NEVER           0
#define BEGIN           1  /* prior to reading 1st row from the
resultset */
#define END             2  /* after reading last row from the result
set  */
#define BEGIN_GROUP     4  /* just read in 1'st row for a different
group */
#define END_GROUP       8  /* just read the last row of the current
group */
#define NEW_RECORD     16  /* uninteresting */
#define PARTIAL_GROUP  32  /* too much data (>max_rex) partial
buffer     */

/* the following are non-grouping events (e.g., db errors, memory) */
#define EXHAUSTED_DF   64  /* exhausted the allocated data.frame  */
#define EXHAUSTED_OUT 128  /* exhausted the allocated output list */
#define END_OF_DATA   256  /* end of data from the result set     */
#define DBMS_ERROR    512  /* error in remote dbms                */

/* beginGroupFun takes only one arg: the name of the current group */
s_object *
RS_DBI_invokeBeginGroup(s_object *callObj,      /* should be
initialized */
                       const char *group_name, /* one string */
                       s_object *rho)
{
   S_EVALUATOR

   s_object *s_group_name, *val;

   /* make a copy of the argument */
   MEM_PROTECT(s_group_name = NEW_CHARACTER((Sint) 1));
   SET_CHR_EL(s_group_name, 0, C_S_CPY(group_name));




_______________________________________________
bug-indent mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-indent







reply via email to

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