public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* bug in gcc
@ 2017-12-28 16:34 Алексей Жевлаков
  0 siblings, 0 replies; 10+ messages in thread
From: Алексей Жевлаков @ 2017-12-28 16:34 UTC (permalink / raw)
  To: gcc-help

Dear Gcc community,

Recently I install gcc using brew packet manager.
I work in macOS Sierra 10.12.6.
I have a bug in work in fortran.
When I make a "print*" or "write(*,*)" in functions then program freezes.

I use gcc 7.2.0.

How I can solve this problem?

best regards

-- 
Dr. Alexey Zhevlakov
Tomsk State University
TSU, Tomsk

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

* Re: bug in gcc
  2016-06-15 11:00     ` Andrew Haley
@ 2016-06-15 13:17       ` Paul Smith
  0 siblings, 0 replies; 10+ messages in thread
From: Paul Smith @ 2016-06-15 13:17 UTC (permalink / raw)
  To: Andrew Haley, Mason, GCC help

On Wed, 2016-06-15 at 12:00 +0100, Andrew Haley wrote:
> On 15/06/16 08:49, Mason wrote:
> > 
> > (To be clear, gcc is warning about the /* comment-start token
> > within a // comment.)
> > 
> > Looking at the documentation for the current release:
> > 
> >   https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
> > 
> > -Wcomment
> >     Warn whenever a comment-start sequence '/*' appears in a '/*'
> > comment, or whenever
> >     a Backslash-Newline appears in a '//' comment. This warning is
> > enabled by -Wall.
> > 
> > The doc doesn't mention warning for /* appearing in a // comment.
> Ah yes, you're quite right.  Something is wrong, but I suspect that
> if anything were to be changed it would be the documentation.

I really hope that the code is changed to match the documentation,
rather than the documentation to match the code.  It's extremely useful
to be able to use line comments to comment out blocks of code, and
warnings (which are often forced to errors in development environments)
about multi-line comments within those blocks would seriously impact
that use-case.

I know you can use tricks like #if 0 etc. but comments are clearer and
more flexible (it's easy to comment out parts of ifdef'd code for
example).

Plus I personally don't see much value in warning about this... what's
the failure case being detected here?

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

* Re: bug in gcc
  2016-06-15  7:49   ` Mason
@ 2016-06-15 11:00     ` Andrew Haley
  2016-06-15 13:17       ` Paul Smith
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Haley @ 2016-06-15 11:00 UTC (permalink / raw)
  To: Mason, GCC help

On 15/06/16 08:49, Mason wrote:
> (To be clear, gcc is warning about the /* comment-start token within a // comment.)
> 
> Looking at the documentation for the current release:
> 
>   https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
> 
> -Wcomment
>     Warn whenever a comment-start sequence '/*' appears in a '/*' comment, or whenever
>     a Backslash-Newline appears in a '//' comment. This warning is enabled by -Wall.
> 
> The doc doesn't mention warning for /* appearing in a // comment.

Ah yes, you're quite right.  Something is wrong, but I suspect that
if anything were to be changed it would be the documentation.

Andrew.

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

* Re: bug in gcc
  2016-06-14 18:20 ` Andrew Haley
@ 2016-06-15  7:49   ` Mason
  2016-06-15 11:00     ` Andrew Haley
  0 siblings, 1 reply; 10+ messages in thread
From: Mason @ 2016-06-15  7:49 UTC (permalink / raw)
  To: GCC help; +Cc: Andrew Haley

On 14/06/2016 20:20, Andrew Haley wrote:

> On 14/06/16 19:18, Jim Michaels wrote:
> 
>> warning: "/*" within comment [-Wcomment]
>>   //case insensitive fs and OS BORLAND/Embarcadero c++ compiler may run on mac/*nix
> 
> Looks correct to me.  What don't you like about this warning?

(To be clear, gcc is warning about the /* comment-start token within a // comment.)

Looking at the documentation for the current release:

  https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

-Wcomment
    Warn whenever a comment-start sequence '/*' appears in a '/*' comment, or whenever
    a Backslash-Newline appears in a '//' comment. This warning is enabled by -Wall.

The doc doesn't mention warning for /* appearing in a // comment.

Regards.

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

* Re: bug in gcc
  2016-06-14 18:18 Jim Michaels
@ 2016-06-14 18:20 ` Andrew Haley
  2016-06-15  7:49   ` Mason
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Haley @ 2016-06-14 18:20 UTC (permalink / raw)
  To: Jim Michaels, gcc-help

On 14/06/16 19:18, Jim Michaels wrote:
> //case insensitive fs and OS BORLAND/Embarcadero c++ compiler may run on 
> mac/*nix
> 
> ^^problem for gcc
> 
> Wed 04/20/2016 
> 6:44:16.48|C:\Users\Kristina\Desktop\prj\egrepsed\egrepsed-1.0\win||>type 
> egrepsed.err.txt
> egrepsed.cpp:1990:77: warning: "/*" within comment [-Wcomment]
>   //case insensitive fs and OS BORLAND/Embarcadero c++ compiler may run 
> on mac/*nix

Looks correct to me.  What don't you like about this warning?

Andrew.

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

* bug in gcc
@ 2016-06-14 18:18 Jim Michaels
  2016-06-14 18:20 ` Andrew Haley
  0 siblings, 1 reply; 10+ messages in thread
From: Jim Michaels @ 2016-06-14 18:18 UTC (permalink / raw)
  To: gcc-help

//case insensitive fs and OS BORLAND/Embarcadero c++ compiler may run on 
mac/*nix

^^problem for gcc

Wed 04/20/2016 
6:44:16.48|C:\Users\Kristina\Desktop\prj\egrepsed\egrepsed-1.0\win||>type 
egrepsed.err.txt
egrepsed.cpp:1990:77: warning: "/*" within comment [-Wcomment]
  //case insensitive fs and OS BORLAND/Embarcadero c++ compiler may run 
on mac/*nix



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

* Re: Bug in GCC
  2010-05-31 15:09   ` Harald Servat
@ 2010-05-31 16:34     ` Harald Servat
  0 siblings, 0 replies; 10+ messages in thread
From: Harald Servat @ 2010-05-31 16:34 UTC (permalink / raw)
  To: naveen yadav; +Cc: gcc-help, gcc-help


Hello,

En/na naveen yadav ha escrit:
> Hi all,
> 
> When I compiled below test program using gcc version 4.1.2 20070925 (Red Hat
> 4.1.2-33) chain it is giving segmentation fault .
> *[naveen@localhost ~]$ ./test.out
> Segmentation fault*
> 
> But the same program is compiled using -O3 flag it is not giving the
> segmentation problem.
> 
> Plz can any one help to debug this problem??
> 
> //test.c
> 
> #include<stdio.h>
> 
> unsigned long FindCompoundSound(void* pPlayer, void* data, unsigned long
> dataLen, unsigned long* formats, unsigned short numFormats,
> void** csData, unsigned long* csDataLen)
> {
> unsigned long foundFormat = 1;
> unsigned short bestMatch = 0xFFFF;
> 
> unsigned long FI_DeviceSound_CacheMask = 0xFFFF;
> unsigned char sData;
> unsigned long sFormat= 0xFF;
> unsigned long sLength;
> 
> unsigned short i;
> 
> 
> 
> for (i=0;i<numFormats;i++)
> {
> if ((formats[i] & FI_DeviceSound_CacheMask) == sFormat)
> {
> if (i < bestMatch)
> {
> bestMatch = i;
> foundFormat = formats[i];
> if (csDataLen)
> {
> *csDataLen = sLength;
> }
> }
> }
> }
> }
> 
> int main(void)
> {
> FindCompoundSound(NULL,NULL,1,
> NULL,1,NULL,NULL);
> return 0;
> 
> }
> 
> Regards,
> 
> Raju G

You're accessing formats[0] and formats == NULL. Probably -O3 does not
expose the segmentation fault because the optimizer is able to remove
that part of code as it's not doing anything useful.

If you want to expose it using -O3 simply add
  printf ("%d\n", bestMatch);
at the end of FindCompoundSound.

Regards.

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

* Re: Bug in GCC
  2010-05-31 10:47 ` Bug in GCC naveen yadav
  2010-05-31 14:26   ` naveen yadav
@ 2010-05-31 15:09   ` Harald Servat
  2010-05-31 16:34     ` Harald Servat
  1 sibling, 1 reply; 10+ messages in thread
From: Harald Servat @ 2010-05-31 15:09 UTC (permalink / raw)
  To: naveen yadav; +Cc: gcc-help, gcc-help


Hello,

En/na naveen yadav ha escrit:
> Hi all,
> 
> When I compiled below test program using gcc version 4.1.2 20070925 (Red Hat
> 4.1.2-33) chain it is giving segmentation fault .
> *[naveen@localhost ~]$ ./test.out
> Segmentation fault*
> 
> But the same program is compiled using -O3 flag it is not giving the
> segmentation problem.
> 
> Plz can any one help to debug this problem??
> 
> //test.c
> 
> #include<stdio.h>
> 
> unsigned long FindCompoundSound(void* pPlayer, void* data, unsigned long
> dataLen, unsigned long* formats, unsigned short numFormats,
> void** csData, unsigned long* csDataLen)
> {
> unsigned long foundFormat = 1;
> unsigned short bestMatch = 0xFFFF;
> 
> unsigned long FI_DeviceSound_CacheMask = 0xFFFF;
> unsigned char sData;
> unsigned long sFormat= 0xFF;
> unsigned long sLength;
> 
> unsigned short i;
> 
> 
> 
> for (i=0;i<numFormats;i++)
> {
> if ((formats[i] & FI_DeviceSound_CacheMask) == sFormat)
> {
> if (i < bestMatch)
> {
> bestMatch = i;
> foundFormat = formats[i];
> if (csDataLen)
> {
> *csDataLen = sLength;
> }
> }
> }
> }
> }
> 
> int main(void)
> {
> FindCompoundSound(NULL,NULL,1,
> NULL,1,NULL,NULL);
> return 0;
> 
> }
> 
> Regards,
> 
> Raju G

You're accessing formats[0] and formats == NULL. Probably -O3 does not
expose the segmentation fault because the optimizer is able to remove
that part of code as it's not doing anything useful.

If you want to expose it using -O3 simply add
  printf ("%d\n", bestMatch);
at the end of FindCompoundSound.

Regards.

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

* Bug in GCC
  2010-05-31 10:47 ` Bug in GCC naveen yadav
@ 2010-05-31 14:26   ` naveen yadav
  2010-05-31 15:09   ` Harald Servat
  1 sibling, 0 replies; 10+ messages in thread
From: naveen yadav @ 2010-05-31 14:26 UTC (permalink / raw)
  To: gcc-help, gcc-help

Hi all,

When I compiled below test program using gcc version 4.1.2 20070925 (Red Hat
4.1.2-33) chain it is giving segmentation fault .
*[naveen@localhost ~]$ ./test.out
Segmentation fault*

But the same program is compiled using -O3 flag it is not giving the
segmentation problem.

Plz can any one help to debug this problem??

//test.c

#include<stdio.h>

unsigned long FindCompoundSound(void* pPlayer, void* data, unsigned long
dataLen, unsigned long* formats, unsigned short numFormats,
void** csData, unsigned long* csDataLen)
{
unsigned long foundFormat = 1;
unsigned short bestMatch = 0xFFFF;

unsigned long FI_DeviceSound_CacheMask = 0xFFFF;
unsigned char sData;
unsigned long sFormat= 0xFF;
unsigned long sLength;

unsigned short i;



for (i=0;i<numFormats;i++)
{
if ((formats[i] & FI_DeviceSound_CacheMask) == sFormat)
{
if (i < bestMatch)
{
bestMatch = i;
foundFormat = formats[i];
if (csDataLen)
{
*csDataLen = sLength;
}
}
}
}
}

int main(void)
{
FindCompoundSound(NULL,NULL,1,
NULL,1,NULL,NULL);
return 0;

}

Regards,

Raju G

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

* Bug in GCC
       [not found] <AANLkTinu9yx7chPAR436ZNAR8PbLSMqZ6wesV3HtN-bO@mail.gmail.com>
@ 2010-05-31 10:47 ` naveen yadav
  2010-05-31 14:26   ` naveen yadav
  2010-05-31 15:09   ` Harald Servat
  0 siblings, 2 replies; 10+ messages in thread
From: naveen yadav @ 2010-05-31 10:47 UTC (permalink / raw)
  To: gcc-help, gcc-help

Hi all,

When I compiled below test program using gcc version 4.1.2 20070925 (Red Hat
4.1.2-33) chain it is giving segmentation fault .
*[naveen@localhost ~]$ ./test.out
Segmentation fault*

But the same program is compiled using -O3 flag it is not giving the
segmentation problem.

Plz can any one help to debug this problem??

//test.c

#include<stdio.h>

unsigned long FindCompoundSound(void* pPlayer, void* data, unsigned long
dataLen, unsigned long* formats, unsigned short numFormats,
void** csData, unsigned long* csDataLen)
{
unsigned long foundFormat = 1;
unsigned short bestMatch = 0xFFFF;

unsigned long FI_DeviceSound_CacheMask = 0xFFFF;
unsigned char sData;
unsigned long sFormat= 0xFF;
unsigned long sLength;

unsigned short i;



for (i=0;i<numFormats;i++)
{
if ((formats[i] & FI_DeviceSound_CacheMask) == sFormat)
{
if (i < bestMatch)
{
bestMatch = i;
foundFormat = formats[i];
if (csDataLen)
{
*csDataLen = sLength;
}
}
}
}
}

int main(void)
{
FindCompoundSound(NULL,NULL,1,
NULL,1,NULL,NULL);
return 0;

}

Regards,

Raju G

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

end of thread, other threads:[~2017-12-28 16:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-28 16:34 bug in gcc Алексей Жевлаков
  -- strict thread matches above, loose matches on Subject: below --
2016-06-14 18:18 Jim Michaels
2016-06-14 18:20 ` Andrew Haley
2016-06-15  7:49   ` Mason
2016-06-15 11:00     ` Andrew Haley
2016-06-15 13:17       ` Paul Smith
     [not found] <AANLkTinu9yx7chPAR436ZNAR8PbLSMqZ6wesV3HtN-bO@mail.gmail.com>
2010-05-31 10:47 ` Bug in GCC naveen yadav
2010-05-31 14:26   ` naveen yadav
2010-05-31 15:09   ` Harald Servat
2010-05-31 16:34     ` Harald Servat

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).