public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/49620] New: piece of code from modification to dvblast but cant get it to compile and run correctly
@ 2011-07-03 19:43 joolzg at btinternet dot com
  2011-07-03 20:39 ` [Bug c/49620] " mikpe at it dot uu.se
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: joolzg at btinternet dot com @ 2011-07-03 19:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49620

           Summary: piece of code from modification to dvblast but cant
                    get it to compile and run correctly
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: joolzg@btinternet.com


Created attachment 24664
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24664
bug report

I have a function that only works when i add another function call inbetween.

block_t *file_Read( mtime_t i_poll_timeout )
{
    i_wallclock = mdate();

    {
        block_t *p_ts, **pp_current = &p_ts;
        int i, i_len;

        if ( !i_last_packet )
        {
            switch (i_print_type) {
            case PRINT_XML:
                printf("<STATUS type=\"lock\" status=\"1\"/>\n");
                break;
            default:
                printf("frontend has acquired lock\n" );
            }
        }
        i_last_packet = i_wallclock;

        i_len = 0;
        for ( i = 0; i < i_bufsize / TS_SIZE; i++ )
        {
            *pp_current = block_New();
            i_len2 = fread( (*pp_current)->p_ts, 1, TS_SIZE, file_input);
//            msg_Warn( NULL, "read from file %s (%s) %d %p",
//                       filename, strerror(errno), i_len2, pp_current );
            if ( i_len2 < 188 )
            {
            if ( i_len2 < 188 )
            {
                msg_Err( NULL, "couldn't read from file %s (%s) %d %p",
                         filename, strerror(errno), i_len2, pp_current );
                i_len = 0;
                break;
            }
            i_len++;
            pp_current = &(*pp_current)->p_next;
        }

        pp_current = &p_ts;
        while ( i_len && *pp_current )
        {
            pp_current = &(*pp_current)->p_next;
            i_len--;
        }

        if ( *pp_current )
            msg_Dbg( NULL, "partial buffer received" );

        block_DeleteChain( *pp_current );
        *pp_current = NULL;

        return p_ts;
    }

    return NULL;
}

Now the code above DOES not work in 
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)
or
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)

Both machines are Ubuntu 64bit.

If the commented out msg_Warn is uncommented then the code works and we get no
error message

Ive also run it through clang and came up with no errors

joolz


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/49620] piece of code from modification to dvblast but cant get it to compile and run correctly
  2011-07-03 19:43 [Bug c/49620] New: piece of code from modification to dvblast but cant get it to compile and run correctly joolzg at btinternet dot com
@ 2011-07-03 20:39 ` mikpe at it dot uu.se
  2011-07-03 21:06 ` joolzg at btinternet dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mikpe at it dot uu.se @ 2011-07-03 20:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49620

--- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> 2011-07-03 20:39:11 UTC ---
Please add a complete self-contained test case.  (The given test case isn't.)
Also please also indicate with which gcc options you compiled the test case.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/49620] piece of code from modification to dvblast but cant get it to compile and run correctly
  2011-07-03 19:43 [Bug c/49620] New: piece of code from modification to dvblast but cant get it to compile and run correctly joolzg at btinternet dot com
  2011-07-03 20:39 ` [Bug c/49620] " mikpe at it dot uu.se
@ 2011-07-03 21:06 ` joolzg at btinternet dot com
  2011-07-03 21:38 ` mikpe at it dot uu.se
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: joolzg at btinternet dot com @ 2011-07-03 21:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49620

--- Comment #2 from julian gardner <joolzg at btinternet dot com> 2011-07-03 21:06:07 UTC ---
(In reply to comment #1)
> Please add a complete self-contained test case.  (The given test case isn't.)
> Also please also indicate with which gcc options you compiled the test case.

Ive given the source and a preprocessed version of the complete file

compiled with
gcc -Wall -O3 -fomit-frame-pointer -Wextra -g
-I/usr/src/kernel/linux-2.6.29.1/include   -c -o file.o file.c

Problem is that adding removing code seems to make the problem
appear/disappear.

I do hope that this is enough, as it seems that the problem is in the 

   i_len2 = fread( ....)
   if( i_len2 < 188)

cant be a much simpler test case

joolz


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/49620] piece of code from modification to dvblast but cant get it to compile and run correctly
  2011-07-03 19:43 [Bug c/49620] New: piece of code from modification to dvblast but cant get it to compile and run correctly joolzg at btinternet dot com
  2011-07-03 20:39 ` [Bug c/49620] " mikpe at it dot uu.se
  2011-07-03 21:06 ` joolzg at btinternet dot com
@ 2011-07-03 21:38 ` mikpe at it dot uu.se
  2011-07-03 21:51 ` joolzg at btinternet dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mikpe at it dot uu.se @ 2011-07-03 21:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49620

--- Comment #3 from Mikael Pettersson <mikpe at it dot uu.se> 2011-07-03 21:38:19 UTC ---
A single .o file is not a complete program, it also needs a main() and whatever
else is needed to call the problematic code and observe whether it worked or
not.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/49620] piece of code from modification to dvblast but cant get it to compile and run correctly
  2011-07-03 19:43 [Bug c/49620] New: piece of code from modification to dvblast but cant get it to compile and run correctly joolzg at btinternet dot com
                   ` (2 preceding siblings ...)
  2011-07-03 21:38 ` mikpe at it dot uu.se
@ 2011-07-03 21:51 ` joolzg at btinternet dot com
  2011-07-04  9:42 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: joolzg at btinternet dot com @ 2011-07-03 21:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49620

--- Comment #4 from julian gardner <joolzg at btinternet dot com> 2011-07-03 21:51:01 UTC ---
(In reply to comment #3)
> A single .o file is not a complete program, it also needs a main() and whatever
> else is needed to call the problematic code and observe whether it worked or
> not.

So you want a buildable executable for a single line of bugged code.

I will try, but what do i do if i cant build a non-working version.

joolz


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/49620] piece of code from modification to dvblast but cant get it to compile and run correctly
  2011-07-03 19:43 [Bug c/49620] New: piece of code from modification to dvblast but cant get it to compile and run correctly joolzg at btinternet dot com
                   ` (3 preceding siblings ...)
  2011-07-03 21:51 ` joolzg at btinternet dot com
@ 2011-07-04  9:42 ` rguenth at gcc dot gnu.org
  2011-07-04 10:00 ` redi at gcc dot gnu.org
  2011-07-07  7:10 ` joolzg at btinternet dot com
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-04  9:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49620

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011.07.04 09:41:57
            Version|unknown                     |4.5.2
     Ever Confirmed|0                           |1

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-04 09:41:57 UTC ---
Please check if the bug still reproduces when you add -fno-inline to the
commandline.  It might be that in the caller you read the pointers via
a different type and thus violate strict aliasing rules (does it work
with -fno-inline?).


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/49620] piece of code from modification to dvblast but cant get it to compile and run correctly
  2011-07-03 19:43 [Bug c/49620] New: piece of code from modification to dvblast but cant get it to compile and run correctly joolzg at btinternet dot com
                   ` (4 preceding siblings ...)
  2011-07-04  9:42 ` rguenth at gcc dot gnu.org
@ 2011-07-04 10:00 ` redi at gcc dot gnu.org
  2011-07-07  7:10 ` joolzg at btinternet dot com
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2011-07-04 10:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49620

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-07-04 09:58:55 UTC ---
(In reply to comment #4)
> So you want a buildable executable for a single line of bugged code.

The source code you posted is not self-contained and the attachment is a
compressed archive that I can't extract on this machine without installing
additional software. See http://gcc.gnu.org/bugs/

*What we do not want*
An attached archive (tar, zip, shar, whatever) containing all (or some :-) of
the above.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/49620] piece of code from modification to dvblast but cant get it to compile and run correctly
  2011-07-03 19:43 [Bug c/49620] New: piece of code from modification to dvblast but cant get it to compile and run correctly joolzg at btinternet dot com
                   ` (5 preceding siblings ...)
  2011-07-04 10:00 ` redi at gcc dot gnu.org
@ 2011-07-07  7:10 ` joolzg at btinternet dot com
  6 siblings, 0 replies; 8+ messages in thread
From: joolzg at btinternet dot com @ 2011-07-07  7:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49620

julian gardner <joolzg at btinternet dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-07-07  7:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-03 19:43 [Bug c/49620] New: piece of code from modification to dvblast but cant get it to compile and run correctly joolzg at btinternet dot com
2011-07-03 20:39 ` [Bug c/49620] " mikpe at it dot uu.se
2011-07-03 21:06 ` joolzg at btinternet dot com
2011-07-03 21:38 ` mikpe at it dot uu.se
2011-07-03 21:51 ` joolzg at btinternet dot com
2011-07-04  9:42 ` rguenth at gcc dot gnu.org
2011-07-04 10:00 ` redi at gcc dot gnu.org
2011-07-07  7:10 ` joolzg at btinternet dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).