Re: Handling C2Y zero-length operations on null pointers

2024-10-07 Thread Qing Zhao via Gcc
> On Oct 7, 2024, at 11:22, Jakub Jelinek wrote: > > On Mon, Oct 07, 2024 at 03:14:22PM +0000, Qing Zhao wrote: >>> Consider the qsort case. My understanding was that the paper is making >>> typedef int (*cmpfn) (const void *, const void *); >>> qsort (

Re: Handling C2Y zero-length operations on null pointers

2024-10-07 Thread Qing Zhao via Gcc
> On Oct 7, 2024, at 10:13, Jakub Jelinek via Gcc wrote: > > On Fri, Oct 04, 2024 at 12:42:24AM +0200, Florian Weimer wrote: >> * Joseph Myers: >> >>> The real question is how to achieve optimal warnings in the absence of the >>> attribute. Should we have a variant of the nonnull attribute t

Re: Should GCC warn about sizeof(flexible_struct)?

2023-08-14 Thread Qing Zhao via Gcc
> On Aug 14, 2023, at 2:41 AM, Richard Biener via Gcc wrote: > > On Fri, Aug 11, 2023 at 8:30 PM Alejandro Colomar via Gcc > wrote: >> >> Hi! >> >> Structures with flexible array members have restrictions about being >> used in arrays or within other structures, as the size of the enclosing

Questions on parallel processing and multi-threading support in GCC's profiling collection

2023-07-17 Thread Qing Zhao via Gcc
Hi, Jan, I did a little search online and also into GCC’s documentation, and found the following several options to support parallel processing and multi-threading during profiling collection: https://gcc.gnu.org/onlinedocs/gcc-10.5.0/gcc/Instrumentation-Options.html -fprofile-dir=path and

Re: [wish] Flexible array members in unions

2023-05-18 Thread Qing Zhao via Gcc
> On May 18, 2023, at 12:25 PM, Martin Uecker via Gcc wrote: > > > >> On Thu, May 11, 2023 at 11:14 PM Kees Cook via Gcc wrote: >>> >>> On Thu, May 11, 2023 at 08:53:52PM +, Joseph Myers wrote: On Thu, 11 May 2023, Kees Cook via Gcc wrote: > On Thu, May 11, 2023 at 06:29:

Re: [wish] Flexible array members in unions

2023-05-15 Thread Qing Zhao via Gcc
> On May 12, 2023, at 2:16 AM, Richard Biener via Gcc wrote: > > On Thu, May 11, 2023 at 11:14 PM Kees Cook via Gcc wrote: >> >> On Thu, May 11, 2023 at 08:53:52PM +, Joseph Myers wrote: >>> On Thu, 11 May 2023, Kees Cook via Gcc wrote: >>> On Thu, May 11, 2023 at 06:29:10PM +0200,

Re: Does gcc automatically lower optimization level for very large routines?

2019-12-20 Thread Qing Zhao
resolve such issue better in the future? thanks. Qing > On Dec 20, 2019, at 5:13 AM, Richard Biener > wrote: > > On December 20, 2019 1:41:19 AM GMT+01:00, Jeff Law <mailto:l...@redhat.com>> wrote: >> On Thu, 2019-12-19 at 17:06 -0600, Qing Zhao wrote: >>>

Re: Does gcc automatically lower optimization level for very large routines?

2019-12-19 Thread Qing Zhao
gt; get beyond a certain threshold. > > Kind regards, > - Dmitry. > > > чт, 19 дек. 2019 г. в 17:38, Qing Zhao : > >> Hi, >> >> When using GCC to compile a very large routine with -O2, it failed with >> out of memory during run time. (O1 is Oka

Does gcc automatically lower optimization level for very large routines?

2019-12-19 Thread Qing Zhao
Hi, When using GCC to compile a very large routine with -O2, it failed with out of memory during run time. (O1 is Okay) As I checked within gdb, when “cc1” was consuming around 95% of the memory, it’s at : (gdb) where #0 0x00ddbcb3 in df_chain_create (src=0x631006480f08, dst=

How to build gcc with address sanitizer?

2019-12-09 Thread Qing Zhao
Hello, When using gcc8.2.1 to build one application, it’s out of memory during “cc1”, We suspect that there are some memory leak problem in “cc1”, therefore tried to build Gcc with address sanitizer in order to detect the memory leak during compilation. However, it took me a lot of time in or

Re: A bug in vrp_meet?

2019-03-04 Thread Qing Zhao
Hi, Richard, > On Mar 4, 2019, at 5:45 AM, Richard Biener wrote: >> >> It looks like DOM fails to visit stmts generated by simplification. Can you >> open a bug report with a testcase? >> >> >> The problem is, It took me quite some time in order to come up with a small >> and independent tes

Re: A bug in vrp_meet?

2019-03-04 Thread Qing Zhao
Richard, thanks a lot for your suggested fix. I will try it. Qing > On Mar 4, 2019, at 5:45 AM, Richard Biener wrote: > > On Fri, Mar 1, 2019 at 10:02 PM Qing Zhao wrote: >> >> >> On Mar 1, 2019, at 1:25 PM, Richard Biener >> wrote: >> >>

Re: A bug in vrp_meet?

2019-03-01 Thread Qing Zhao
> On Mar 1, 2019, at 1:25 PM, Richard Biener wrote: > > On March 1, 2019 6:49:20 PM GMT+01:00, Qing Zhao <mailto:qing.z...@oracle.com>> wrote: >> Jeff, >> >> thanks a lot for the reply. >> >> this is really helpful. >> >> I doub

Re: A bug in vrp_meet?

2019-03-01 Thread Qing Zhao
> On Feb 28, 2019, at 1:54 PM, Jeff Law wrote: > > On 2/28/19 10:05 AM, Qing Zhao wrote: >> Hi, >> >> I have been debugging a runtime error caused by value range propagation. and >> finally located to the following gcc routine: >> >> vrp_meet_1 in gc

A bug in vrp_meet?

2019-02-28 Thread Qing Zhao
Hi, I have been debugging a runtime error caused by value range propagation. and finally located to the following gcc routine: vrp_meet_1 in gcc/tree-vrp.c /* Meet operation for value ranges. Given two value ranges VR0 and VR1, store in VR0 a range that contains both VR0 and VR1. This

Gcc profile questions

2019-02-19 Thread Qing Zhao
Hi, Suppose we have a program called foo which is built with gcc -fprofile-generate, Now when foo is executed a bunch of .gcda files are created. What happens when foo is executed more than once. Are the .gcda files updated with each execution? Or are the .gcda files overwritten with new

Re: Question on -fopt-info-inline

2018-07-10 Thread Qing Zhao
> On Jul 10, 2018, at 11:32 AM, Richard Biener > wrote: > > On July 10, 2018 5:42:40 PM GMT+02:00, Qing Zhao wrote: >> Hi, David, >> >> thanks a lot for your information. very helpful. >> >> specifically, I am mostly interested in the inline report

Re: Question on -fopt-info-inline

2018-07-10 Thread Qing Zhao
Hi, David, thanks a lot for your information. very helpful. specifically, I am mostly interested in the inline report part of the opt-info: 1. what’s the current status of inlining report through opt-info? (with the upstream GCC last week, the -fopt-info-inline report nothing) 2. what’s the pl

Re: Question on -fopt-info-inline

2018-07-05 Thread Qing Zhao
> On Jul 3, 2018, at 7:19 PM, Jeff Law wrote: > > On 07/03/2018 12:28 PM, Qing Zhao wrote: >> >>>> >>>>> >>>>> In order to collect complete information on all the inlining >>>>> transformation that GCC applies on a give

Re: Question on -fopt-info-inline

2018-07-03 Thread Qing Zhao
>> >>> >>> In order to collect complete information on all the inlining >>> transformation that GCC applies on a given program, >>> I searched online, and found that the option -fopt-info-inline might be >>> the right option to use: >>> >>> https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.

Re: Question on -fopt-info-inline

2018-07-03 Thread Qing Zhao
> On Jul 3, 2018, at 11:48 AM, Richard Biener > wrote: > > On July 3, 2018 6:01:19 PM GMT+02:00, Qing Zhao <mailto:qing.z...@oracle.com>> wrote: >> Hi, >> >> In order to collect complete information on all the inlining >> transformation that

Question on -fopt-info-inline

2018-07-03 Thread Qing Zhao
Hi, In order to collect complete information on all the inlining transformation that GCC applies on a given program, I searched online, and found that the option -fopt-info-inline might be the right option to use: https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html

Re: Please review writeup for fixing PR 78809 (inline strcmp for small constant strings)

2017-11-20 Thread Qing Zhao
> On Nov 17, 2017, at 7:39 PM, Jeff Law wrote: > >>> >> >> thanks for the info, Martin. >> >> In my case, it’s the size of “100” cannot be collected in the >> MINMAXLEN[1] for the string “s”. >> >> I need to make sure that the size of variable string s is larger than >> the size of constant

Re: Please review writeup for fixing PR 78809 (inline strcmp for small constant strings)

2017-11-20 Thread Qing Zhao
> On Nov 17, 2017, at 7:32 PM, Jeff Law wrote: > > On 11/17/2017 03:45 PM, Qing Zhao wrote: >>>> do you think using this routine is good? or do you have other >>>> suggestions (since I am still not very familiar with the internals of >>>> GCC, might

Re: Please review writeup for fixing PR 78809 (inline strcmp for small constant strings)

2017-11-20 Thread Qing Zhao
> On Nov 17, 2017, at 5:54 PM, Martin Sebor wrote: > >> >> for the safety checking purpose, when we try to convert >> >> __builtin_strcmp(s, "abc") != 0 >> >> to >> >> __builtin_memcmp (s, “abc”, 4) != 0 >> >> we have to make sure that the size of variable “s” is larger than “4”. > > Presu

Re: Please review writeup for fixing PR 78809 (inline strcmp for small constant strings)

2017-11-17 Thread Qing Zhao
> On Nov 17, 2017, at 1:50 AM, Jakub Jelinek wrote: > > On Thu, Nov 16, 2017 at 06:14:35PM -0700, Jeff Law wrote: >>> However, this routine currently miss a very obvious case as the following: >>> >>> char s[100] = {'a','b','c','d’}; >>> >>> __builtin_strcmp(s, "abc") != 0 >>> >>> So, I have

Re: Please review writeup for fixing PR 78809 (inline strcmp for small constant strings)

2017-11-17 Thread Qing Zhao
A would like to be put in gimple fold phase (in routine "gimple_fold_builtin_string_compare" of gimple-fold.c >> OK. Note that various optimizations can expose N or one of the strings >>> to be a constant. So having it as part of the folders makes a lot of >>> sense . >>

Re: Please review writeup for fixing PR 78809 (inline strcmp for small constant strings)

2017-11-17 Thread Qing Zhao
Hi, Jeff, > On Nov 16, 2017, at 7:14 PM, Jeff Law wrote: >> >> In my current local implementation, I used the following routine to get >> the range info: (and use the MINMAXLEN[1]+1 for the length of the >> non-constant string) >> >> /* Determine the minimum and maximum value or string length

Re: Please review writeup for fixing PR 78809 (inline strcmp for small constant strings)

2017-11-17 Thread Qing Zhao
> On Nov 16, 2017, at 6:24 PM, Martin Sebor wrote: >> >> In my current local implementation, I used the following routine to get the >> range info: (and use the MINMAXLEN[1]+1 for the length of the non-constant >> string) >> >> /* Determine the minimum and maximum value or string length that

Re: Please review writeup for fixing PR 78809 (inline strcmp for small constant strings)

2017-11-17 Thread Qing Zhao
> On Nov 16, 2017, at 5:55 PM, Martin Sebor wrote: >> >> A. for strncmp (s1, s2, n) >> if one of "s1" or "s2" is a constant string, "n" is a constant, and >> larger than the length of the constant string: >> change strncmp (s1, s2, n) to strcmp (s1, s2); > > Here and I think in som

Re: Please review writeup for fixing PR 78809 (inline strcmp for small constant strings)

2017-11-16 Thread Qing Zhao
Hi, Jeff, thanks a lot for your comments. please see my reply in below: > On Nov 16, 2017, at 12:47 PM, Jeff Law wrote: > >> >> B. for strncmp (s1, s2, n) (!)= 0 or strcmp (s1, s2) (!)= 0 >> if the result is ONLY used to do a simple equality test against zero, >> one of "s1" or "s2" i

Please review writeup for fixing PR 78809 (inline strcmp for small constant strings)

2017-11-03 Thread Qing Zhao
nd let me know any comments and suggestions: thanks a lot. Qing str(n)cmp and memcmp optimization in gcc -- A design document for PR78809 11/01/2017 Qing Zhao === 0. Summary: For PR 78809