Re: Should --enable-debug set CFLAGS to -O0 instead of -O2?

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Should --enable-debug set CFLAGS to -O0 instead of -O2?
Date: 2025-08-01 05:24:14
Message-ID: CAEoWx2=eCm75xg7vuyQrM_ADAAVd3KY7C9OFLPOQ0U3i9fU5Aw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

My bad. You are right, the last -O will work. Then I think I get a solution
to my original problem. Thanks again for your help.

Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 于2025年8月1日周五 12:07写道:

> Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> writes:
> > Thanks for the explanation. W.R.T the PROFILE variable, I tried:
>
> > # ./configure --enable-debug
> > # PROFILE="-O0" make
>
> > As a result, both "-O2" and "-O0" presented to gcc. In that case, I
> believe
> > "-O0" will be ignored by gcc.
>
> Nope ... read the gcc docs, or experiment. The last -O switch wins.
> (This is true for most switches in most Unix tools, and it's common
> for scripts such as Makefiles to rely on it.)
>
> regards, tom lane
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2025-08-01 05:24:41 Dropping publication breaks logical replication
Previous Message Tom Lane 2025-08-01 05:07:33 Re: Convert varatt.h macros to static inline functions