[Bug c/49620] New: piece of code from modification to dvblast but cant get it to compile and run correctly

2011-07-03 Thread joolzg at btinternet dot com
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: unassig...@gcc.gnu.org
ReportedBy: joo...@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("\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


[Bug c/49620] piece of code from modification to dvblast but cant get it to compile and run correctly

2011-07-03 Thread joolzg at btinternet dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49620

--- Comment #2 from julian gardner  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


[Bug c/49620] piece of code from modification to dvblast but cant get it to compile and run correctly

2011-07-03 Thread joolzg at btinternet dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49620

--- Comment #4 from julian gardner  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


[Bug c/49620] piece of code from modification to dvblast but cant get it to compile and run correctly

2011-07-07 Thread joolzg at btinternet dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49620

julian gardner  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution||INVALID