From owner-freebsd-questions@freebsd.org Sun Jun 11 12:26:36 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39E2DD8641F for ; Sun, 11 Jun 2017 12:26:36 +0000 (UTC) (envelope-from serpent7776@gmail.com) Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC22B3F01 for ; Sun, 11 Jun 2017 12:26:35 +0000 (UTC) (envelope-from serpent7776@gmail.com) Received: by mail-lf0-x243.google.com with SMTP id o28so7832774lfk.1 for ; Sun, 11 Jun 2017 05:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Tnq6nEet+i5zijyOSs6HNm1st9PY8Vr2bte11Om5Syc=; b=JOjTeynTn4QuF/W4W5jGVb3rXw8qvNyehulqe4KRn4WxevbdX8KM278+XRQCClcgcS qW9hXPa/rct1r4kG4CwovNbKWs84AnY/wcPpZtXYoLlcf2X2LGfXeaKSrqLsHMhTO7l+ UOSgDzq1ByxP1k6i2ykjypszHFlypxRmaL08R57nA/YjDdOutOMo1WF4Rqwk7o4Yw8xQ ZRzthfZHEYUHCdi1b8nGcxHqnt33VHbzn7eKhHNwO68v/s9vrH4SZwiIm30kNZJHf/oB kXh6AqB9uCCRcXXCpfjFQcvRuOcwvxJML6mUJEkGWC+cC48WrSwTbwgxJPzkkfMBaVO7 y/Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Tnq6nEet+i5zijyOSs6HNm1st9PY8Vr2bte11Om5Syc=; b=EnGGQKmBkKyWkqeB/blCtgqlhmkcZvL6Vnd7gaCkUO8i6d5IxhDpoPqF5IW+pjwMsH qdMyCndxmhVHbwshKAOWbz992l+ObI83yDr/NGZKqFUtwLrPtcPSe9npjAQtPT9ZLkKm RWeI38msxQjrOKZqJNfhKkGA1LI3iAQFHYEHnGw8vyEvDtJR3TOX9qGRmWZAw/OudFkw bcXGwmgCZgPniawUwDnN9PKTux9OODxfK4Xro6UBbJiTtm6FWyeh72oqs1z31KRYfXKs WBMuZ6p9zLmrXdkq5nEs1U8S4NR3Oaso4TQINmUd69VAHAx2LDa403k002vSIjKOSpFi tCdw== X-Gm-Message-State: AODbwcCu9L7/yBv5BwIjdCJRI3V9vnZI84G6ORMRZ20oPKsmHBb9ycFd oW0wrIwHniCS7g== X-Received: by 10.25.221.136 with SMTP id w8mr3237948lfi.14.1497183993585; Sun, 11 Jun 2017 05:26:33 -0700 (PDT) Received: from DaemONX (90-156-31-193.internetia.net.pl. [90.156.31.193]) by smtp.gmail.com with ESMTPSA id f16sm1813682lff.48.2017.06.11.05.26.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Jun 2017 05:26:33 -0700 (PDT) Date: Sun, 11 Jun 2017 14:25:17 +0200 From: Serpent7776 To: Friedrich Locke Cc: freebsd-questions@freebsd.org Subject: Re: -O2 flag Message-ID: <20170611142517.5898c64e@DaemONX> In-Reply-To: <593C892D.4070200@gmail.com> References: <593C4679.5010104@gmail.com> <20170610230928.581e3cf9@DaemONX> <593C892D.4070200@gmail.com> X-Mailer: Claws Mail 3.15.0 (GTK+ 2.24.31; amd64-portbld-freebsd10.3) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jun 2017 12:26:36 -0000 On Sat, 10 Jun 2017 21:05:01 -0300 Friedrich Locke wrote: > Here you have it: > > gustav# cc --version > FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on > LLVM 3.8.0) > Target: x86_64-unknown-freebsd11.0 > Thread model: posix > InstalledDir: /usr/bin > gustav# This is not telling much. As pointed by Patrick this might be due to uninitialized stack variables in a function. You might want to try to: - rebuild with enabled compiler warning flags (-W flags) https://clang.llvm.org/docs/DiagnosticsReference.html - rebuild with sanitizer enabled https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html - try running in debugger and find place where this error occurs HTH > Em 10/06/2017 18:09, Serpent7776 escreveu: > > On Sat, 10 Jun 2017 16:20:25 -0300 > > Friedrich Locke wrote: > > > >> Hi folks, > >> > >> i am trying compile a program with cc on freebsd 11. > >> When i use -O2 compilation flag, the compiled code is giving error on > >> execution, but with i omit -O2 everything works ok. > >> > >> Have anybody already faced such problem ? > > Yes, a few times in the past. Your code may have hidden bug which is > > triggered only with optimizations enabled. It might be relying on some kind > > of undefined behaviour. > > Unfortunately, I don't have any helpful advices on how to find this error - > > try enabling all compiler warnings flags. > > I'd suspect a bug in your code rather than a bug in compiler, but the > > latter is not impossible. > > > >> Thanks in advance. > >> _______________________________________________ > >> freebsd-questions@freebsd.org mailing list > >> https://lists.freebsd.org/mailman/listinfo/freebsd-questions > >> To unsubscribe, send any mail to > >> "freebsd-questions-unsubscribe@freebsd.org" > > > > > > -- /* * Serpent7776 */