From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by sourceware.org (Postfix) with ESMTPS id D7DC63858C50 for ; Thu, 28 Jul 2022 14:24:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D7DC63858C50 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=eckhardttrading.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=eckhardttrading.com Received: by mail-qk1-x735.google.com with SMTP id f14so1572998qkm.0 for ; Thu, 28 Jul 2022 07:24:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eckhardttrading-com.20210112.gappssmtp.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=YCqfGiswoFjA45T4TuiB4n3s6gL/vON7t+weQhCD1E4=; b=al31TSaif3hHNC+tJgUVzEINYoN81zto+MKirHkrTcPcdwQuu+ssRwSdF5Hn/kyUed nfVi/DiNdUz0P+rAdLsZ+voeU5I1pZcQtKdbIovyDUCjPllvpw7yW+N0DHdH+71FgEdC KE4is9XGkeZQ1qQj2ytwdKrWtoaAnw+xLblasQOho9REV+AvFzztJQVK+m3z1/mQ57Js B591Dnji70/ifdGET0xUBm2l81vPjXeRZXMoBjm2EsCQZl6ANkvHdekEw12HLtp0a0Rk 1tIBeJXzJUurATXZUhBSzIXkVTmQceQxf0Cn8gdxkcXOrkQbRxMHQWv5ms5TdWhghwCA xZiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=YCqfGiswoFjA45T4TuiB4n3s6gL/vON7t+weQhCD1E4=; b=xQM6iem37MTBn42C9vmqjFJF5TQiJXA4/IKWa3+BYGfGT7DcGgYMnozJi/DmSOLzVI HxojQphqHGtjqdW3artptb83uEMzroI/dFgLumDqKb5MAU3PbIIusbPEzy7IgKwncBM0 yL15Thc2enGnZIqn9TS9uYCi7pF5w6yTLAvmLt7O3CpjCpfGiNzq2QhLxTWbaV7jNpZr cM2O3w+FLGOqXlhrqyF9n1JQ3Zllecjg7KvK4CRPAvgcPsI2loPtD/qvveTMtc5UXt3v fdfyITTYPenQ7Hcuk5pxYPWWdDsRB6Leg7MIAB6KxuSktZkzWNsKawqz0PGngeD0HBv4 akqA== X-Gm-Message-State: AJIora+2FuEaJbJQz3q+hIv4+LrIdh68jFNU5s1cA8m7qla+CjMLsmrG X+BQ9ZgOWyaX5xAFR0UQ9K5QAtKGyT2psfULfpngP9yHl3DkeAK8qIhO5PhWCXX6aGwZ94TSqiT 8a9yfM8us2djXDrqEG+pomAOEdSlk X-Google-Smtp-Source: AGRyM1uUvBq+lXSbm38LnP3rvCS17fhaWn7i7ANk+zW5PiKG/5Wtm6+bWDvmcRqymkC6+BrnG9uxh9wGS8+nJkqAH9U= X-Received: by 2002:a05:620a:4103:b0:6b6:e86:a8cf with SMTP id j3-20020a05620a410300b006b60e86a8cfmr20605412qko.194.1659018296755; Thu, 28 Jul 2022 07:24:56 -0700 (PDT) MIME-Version: 1.0 From: David Brown Date: Thu, 28 Jul 2022 09:24:30 -0500 Message-ID: Subject: force the (gfortran) compiler to not optimize out a variable To: gcc-help@gcc.gnu.org X-Spam-Status: No, score=1.7 required=5.0 tests=BAYES_50, DKIM_SIGNED, DKIM_VALID, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2022 14:24:59 -0000 To be able to easily identify the version of an executable binary, we embed a version string in the code, i.e. character(len=64) :: vers='<<>>'//achar(0) ... character(len=256) c256 and then use the strings command to (we're running redhat) to be able to quickly identify the version of the executable, i.e. [db@VI1 src]$ strings ../bin/bltr4.exe | grep "<<>> The only problem is that to make sure the variable vers does not get optimized out by the compiler, I have to include code like this c256=vers !needed so version string does not get optimized out by compiler We do need to make sure the code is optimized, but having to include that above assignment statement is not only somewhat obtuse but in some edge cases chews up resources (some of the programs are very time/resource sensitive). I've tried various work arounds, but in summary the above assignment seems to be the only way to insure the compiler does not optimize out the vers string. Is there any way to force the compiler to keep a variable in the executable, yet otherwise have the optimizer on? Thanks in advance David -- David Brown Eckhardt Trading Company 300 S. Wacker Drive, Suite 1080 Chicago, IL 60606 Tel: 312-765-0565 x1006 -- PAST PERFORMANCE IS NOT NECESSARILY INDICATIVE OF FUTURE RESULTS. This message (including any attachments) contains confidential information intended for a specific individual and purpose and is protected by law. Any use, distribution, disclosure, alteration, copying or re-transmittal by persons who are not intended recipients of this email may be a violation of law and is strictly prohibited. If you are not the intended recipient, please permanently delete all copies of this e-mail and any attachments from your computer system and destroy any hard copies. This e-mail and any attachments hereto are for informational purposes only and should not be construed as an offer to provide advisory services, or sell interests in any investment vehicle managed, by the Trading Advisor or its affiliates. Any information regarding trading performance must be considered in conjunction with the appropriate disclosure documents.